code: def test_to_undirected(self):
      # MultiDiGraph -> MultiGraph changes number of edges so it is
      # not a copy operation... use is_shallow, not is_shallow_copy
      G = self.K3
      self.add_attributes(G)
      H = nx.MultiGraph(G)
      # self.is_shallow(H,G)
      # the result is traversal order dependent so we
      # can't use the is_shallow() test here.
      try:
          assert edges_equal(H.edges(), [(0, 1), (1, 2), (2, 0)])
      except AssertionError:
          assert edges_equal(
              H.edges(), [(0, 1), (1, 2), (1, 2), (2, 0)]
          )
      H = G.to_undirected()
      self.is_deep(H, G)
  
imports: from collections import UserDict
  import pytest
  import networkx
  from networkx.utils import edges_equal
  from .test_multigraph import BaseMultiGraphTester
  from .test_multigraph import TestEdgeSubgraph
  from .test_multigraph import TestMultiGraph
label_desc: Use image node_id 12 for calling the BaseMultiDiGraphTester obj's underlying member method code with example usage: obj.test_to_undirected() without return types