code: def _assert_is_identical_hetero(g, g2):
      assert g.ntypes == g2.ntypes
      assert g.canonical_etypes == g2.canonical_etypes
  
      # check if two metagraphs are identical
      for edges, features in g.metagraph().edges(keys=True).items():
          assert g2.metagraph().edges(keys=True)[edges] == features
  
      # check if node ID spaces and feature spaces are equal
      for ntype in g.ntypes:
          assert g.num_nodes(ntype) == g2.num_nodes(ntype)
  
      # check if edge ID spaces and feature spaces are equal
      for etype in g.canonical_etypes:
          src, dst = g.all_edges(etype=etype, order="eid")
          src2, dst2 = g2.all_edges(etype=etype, order="eid")
          assert F.array_equal(src, src2)
          assert F.array_equal(dst, dst2)
  
file_path: dgl/tests/python/common/test_heterograph-shared-memory.py
imports: import io
  import multiprocessing
  import os
  import pickle
  import unittest
  import backend
  import dgl
  import dgl.function
  import networkx
  import scipy.sparse
  from dgl.graph_index import create_graph_index
  from dgl.utils import toindex
  from utils import parametrize_idtype
label_desc: Use image node_id 2 for calling a global function with example usage: _assert_is_identical_hetero(g, g2) without return types