code: def test_from_networkx_weights():
      expected_nodes = {
          "a": pd.DataFrame(columns=range(0), index=[0, 2, 1]),
      }
  
      x_edges = [(0, 2, {"w": 2.0}), (0, 2), (1, 2), (1, 2)]
      xs = len(x_edges)
      y_edges = [(0, 1, {"w": 3.0, "e": "y"})]
      ys = len(y_edges)
  
      def df_edge(edge_tuple):
          src, tgt = edge_tuple[:2]
          try:
              attrs = edge_tuple[2]
          except IndexError:
              attrs = {}
          weight = attrs.get("w", 1)
          return src, tgt, weight
  
      expected_edges = {
          "x": pd.DataFrame(
              [df_edge(t) for t in x_edges],
              columns=["source", "target", "w"],
              index=[0, 1, 3, 4],
          ),
          "y": pd.DataFrame(
              [df_edge(t) for t in y_edges],
              columns=["source", "target", "w"],
              index=[2],
          ),
      }
  
      g = nx.MultiDiGraph()
      g.add_edges_from(x_edges + 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 23 for calling a global function with example usage: test_from_networkx_weights() and returns: src,  tgt,  weight