code: def from_networkx(
      graph,
      *,
      node_type_attr,
      edge_type_attr,
      node_type_default,
      edge_type_default,
      edge_weight_attr,
      node_features,
      dtype,
  ):
      import networkx as nx
  
      nodes = defaultdict(_empty_node_info)
  
      features_in_node = isinstance(node_features, str)
  
      for node_id, node_data in graph.nodes(data=True):
          node_type = node_data.get(node_type_attr, node_type_default)
          node_info = nodes[node_type]
          node_info.ids.append(node_id)
          if features_in_node:
              node_info.features.append(
                  node_data.get(node_features, None)
              )
  
      if features_in_node or node_features is None:
          node_frames = {
              node_type: pd.DataFrame(
                  _features_from_attributes(
                      node_type,
                      node_info.ids,
                      node_info.features,
                      dtype,
                  ),
                  index=node_info.ids,
              )
              for node_type, node_info in nodes.items()
          }
      else:
          node_frames = _features_from_node_data(
              nodes, node_type_default, node_features, dtype
          )
  
      edges = nx.to_pandas_edgelist(graph, source=SOURCE, target=TARGET)
      _fill_or_assign(edges, edge_type_attr, edge_type_default)
      _fill_or_assign(edges, edge_weight_attr, DEFAULT_WEIGHT)
      edges_limited_columns = edges[
          [SOURCE, TARGET, edge_type_attr, edge_weight_attr]
      ]
      edge_frames = {
          edge_type: data.drop(columns=edge_type_attr)
          for edge_type, data in edges_limited_columns.groupby(
              edge_type_attr
          )
      }
  
      return node_frames, edge_frames
  
imports: from collections import defaultdict, namedtuple
  from typing import Iterable
  import warnings
  import numpy
  import pandas
  from ..globalvar import SOURCE, TARGET, WEIGHT, TYPE_ATTR_NAME
  from .element_data import NodeData, EdgeData
  from .indexed_array import IndexedArray
  from .validation import comma_sep, require_dataframe_has_columns
  from .utils import is_real_iterable, zero_sized_array, smart_array_concatenate, smart_array_index
label_desc: Use image node_id 7 for calling a global function with example usage: from_networkx(graph) and returns: node_frames,  edge_frames