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