def get_id2children(objs):
    """Get all parent item IDs for each item in dict keys."""
    id2children = {}
    for obj in objs:
        _get_id2children(id2children, obj.item_id, obj)
    return id2children
def get_id2children ( objs ) : id2children = { } for obj in objs : _get_id2children ( id2children , obj . item_id , obj ) return id2children
Get all parent item IDs for each item in dict keys.