code: def store_concepts_by_type(graph):
      """
      Organises concepts by type the same way `data.to_heterogeneous()` organises nodes by type. This is necessary to
      be able to map back from a `HeteroData` object to the TypeDB concepts that the nodes refer to.
      Args:
          graph: NetworkX graph to operate on
      Returns:
          The same graph, with a field `concepts_by_type` holding concepts organised by type
      """
      concepts_by_type = {}
      for node_data in multidigraph_node_data_iterator(graph):
          typ = node_data["type"]
          if typ in concepts_by_type:
              concepts_by_type[typ].append(node_data["concept"])
          else:
              concepts_by_type[typ] = [node_data["concept"]]
      graph.concepts_by_type = concepts_by_type
      return graph
  
label_desc: Use image node_id 2 for calling a global function with example usage: store_concepts_by_type(graph) and returns: graph