code: def assert_scipy_api_compat(G, dataset_path, api_type):
      """
      Ensure cugraph.scc() and cugraph.connected_components() can be used as
      drop-in replacements for scipy.connected_components():
  
      scipy.sparse.csgraph.connected_components(csgraph,
                                                directed=True,
                                                connection='weak',
                                                return_labels=True)
      Parameters
      ----------
          csgraph : array_like or sparse matrix
              The N x N matrix representing the compressed sparse graph. The
              input csgraph will be converted to csr format for the calculation.
          directed : bool, optional
              If True (default), then operate on a directed graph: only move from
              point i to point j along paths csgraph[i, j]. If False, then find
              the shortest path on an undirected graph: the algorithm can
              progress from point i to j along csgraph[i, j] or csgraph[j, i].
          connection : str, optional
              [‘weak’|’strong’]. For directed graphs, the type of connection to
              use. Nodes i and j are strongly connected if a path exists both
              from i to j and from j to i. A directed graph is weakly connected
              if replacing all of its directed edges with undirected edges
              produces a connected (undirected) graph. If directed == False, this
              keyword is not referenced.
          return_labels : bool, optional
              If True (default), then return the labels for each of the connected
              components.
  
      Returns
      -------
          n_components : int
              The number of connected components.
          labels : ndarray
              The length-N array of labels of the connected components.
      """
      api_call = {
          "strong": cugraph.strongly_connected_components,
          "weak": cugraph.weakly_connected_components,
      }[api_type]
      connection = api_type
      wrong_connection = {"strong": "weak", "weak": "strong"}[api_type]
  
      input_cugraph_graph = G
      input_coo_matrix = utils.create_obj_from_csv(
          dataset_path, cp_coo_matrix, edgevals=True
      )
  
      # Ensure scipy-only options are rejected for cugraph inputs
      with pytest.raises(TypeError):
          api_call(input_cugraph_graph, directed=False)
      with pytest.raises(TypeError):
          api_call(input_cugraph_graph, return_labels=False)
  
      # Setting connection to strong for strongly_* and weak for weakly_* is
      # redundant, but valid
  
      api_call(input_cugraph_graph, connection=connection)
  
      # Invalid for the API
      with pytest.raises(TypeError):
          (n_components, labels) = api_call(
              input_coo_matrix,
              directed=False,
              connection=wrong_connection,
          )
  
      (n_components, labels) = api_call(
          input_coo_matrix, directed=False
      )
      (n_components, labels) = api_call(
          input_coo_matrix, directed=False, connection=connection
      )
      n_components = api_call(
          input_coo_matrix, directed=False, return_labels=False
      )
      assert type(n_components) is int
  
imports: import gc
  import time
  from collections import defaultdict
  import pytest
  import cupy
  import numpy
  import networkx
  from cupyx.scipy.sparse import coo_matrix
  from cupyx.scipy.sparse import csr_matrix
  from cupyx.scipy.sparse import csc_matrix
  from scipy.sparse import coo_matrix
  from scipy.sparse import csr_matrix
  from scipy.sparse import csc_matrix
  from cugraph.utilities import is_nx_graph_type
  import cudf
  import cugraph
  from cugraph.testing import utils, DEFAULT_DATASETS
  from cugraph.datasets import dolphins, netscience, email_Eu_core
label_desc: Use image node_id 6 for calling a global function with example usage: assert_scipy_api_compat(G, dataset_path, api_type) without return types