code: def test_from_networkx_heterogeneous_partial():
      # check that specifying node and edge types works, even when interleaved with unspecified types
      a_nodes = [0, (1, {"n": "a"})]
      b_nodes = [(2, {"n": "b"})]
      expected_nodes = {
          "a": pd.DataFrame(columns=range(0), index=[0, 1]),
          "b": pd.DataFrame(columns=range(0), index=[2]),
      }
  
      x_edges = [(0, 2, {"e": "x"}), (0, 2), (1, 2), (1, 2)]
      xs = len(x_edges)
      y_edges = [(0, 1, {"e": "y"})]
      ys = len(y_edges)
      expected_edges = {
          "x": pd.DataFrame(
              [t[:2] for t in x_edges],
              columns=["source", "target"],
              index=[0, 1, 3, 4],
          ).assign(w=W),
          "y": pd.DataFrame(
              [t[:2] for t in y_edges],
              columns=["source", "target"],
              index=[2],
          ).assign(w=W),
      }
  
      g = nx.MultiDiGraph()
      g.add_nodes_from(a_nodes)
      g.add_nodes_from(b_nodes)
      g.add_edges_from(x_edges)
      g.add_edges_from(y_edges)
      nodes, edges = from_networkx_for_testing(g)
  
      assert_dataframe_dict_equal(nodes, expected_nodes)
      assert_dataframe_dict_equal(edges, expected_edges)
  
imports: import networkx
  import numpy
  import pandas
  import pytest
  from stellargraph.core.convert import ColumnarConverter, convert_nodes, convert_edges, from_networkx
  from stellargraph.core.indexed_array import IndexedArray
label_desc: Use image node_id 22 for calling a global function with example usage: test_from_networkx_heterogeneous_partial() without return types