code: def compare(name, create_using, *args, is_vanilla=False):
      exc1 = exc2 = None
      func = getattr(nx, name)
      if isinstance(create_using, nxcg.Graph):
          nx_create_using = nxcg.to_networkx(create_using)
      elif isinstance(create_using, type) and issubclass(
          create_using, nxcg.Graph
      ):
          nx_create_using = create_using.to_networkx_class()
      elif isinstance(create_using, nx.Graph):
          nx_create_using = create_using.copy()
      else:
          nx_create_using = create_using
      try:
          if is_vanilla:
              G = func(*args)
          else:
              G = func(*args, create_using=nx_create_using)
      except Exception as exc:
          exc1 = exc
      try:
          if is_vanilla:
              Gcg = func(*args, backend="cugraph")
          else:
              Gcg = func(
                  *args, create_using=create_using, backend="cugraph"
              )
      except ZeroDivisionError:
          raise
      except NotImplementedError as exc:
          if name in {
              "complete_multipartite_graph"
          }:  # nx.__version__[:3] <= "3.2"
              return
          exc2 = exc
      except Exception as exc:
          if exc1 is None:  # pragma: no cover (debug)
              raise
          exc2 = exc
      if exc1 is not None or exc2 is not None:
          assert type(exc1) is type(exc2)
      else:
          assert_graphs_equal(G, Gcg)
  
file_path: cugraph/python/nx-cugraph/nx_cugraph/tests/test_generators.py
imports: import networkx
  import numpy
  import pytest
  from packaging.version import parse
  import nx_cugraph
label_desc: Use image node_id 2 for calling a global function with example usage: compare(name, create_using) without return types