code: def get_graph(self, item_ids, language=None):
          def _related(item_ids):
              if item_ids is None:
                  items = Item.objects.filter(active=True).prefetch_related('parents', 'children')
              else:
                  item_ids = [ii for iis in item_ids.values() for ii in iis]
                  items = Item.objects.filter(id__in=item_ids, active=True).prefetch_related('parents', 'children')
              return {item.id: sorted([_item.id for rel in [item.parents.all(), item.children.all()] for _item in rel]) for item in items}
          if item_ids is None:
              return self._reachable_graph(None, _related, language=language)
          else:
              graph = self.get_graph(None, language)
              return self._subset_graph(graph, item_ids)