code: def _get_bond_scopes(
      edge_index: ArrayLike, graph_index: ArrayLike
  ) -> List[List[int]]:
      """Bond scope is a list of tuples with a single entry for every molecule
      in the batched graph. The entry indicates the beginning bond index for a
      molecule and the number of bonds in the molecule.
  
      Parameters
      ----------
      edge_index: np.array
          Graph connectivity in COO format with shape [2, num_edges]
      graph_index: np.array
          An array containing a mapping between node index and the graph
      in the batched graph.
  
      Returns
      -------
      scopes: List[List[int]]
          Bond index scope for each molecule in the batched graph.
  
      Example
      -------
      >>> edge_index = np.array([[0, 1, 2, 4], [1, 0, 4, 2]]) # a molecule with 4 bonds
      >>> graph_index = np.array([0, 0, 1, 1, 1])
      >>> _get_bond_scopes(edge_index, graph_index)
      [[0, 2], [2, 2]]
      """
      mols = np.unique(graph_index)
      bond_index = graph_index[edge_index[0]]  # type: ignore
      scopes = []
      for mol in mols:
          positions = np.where(bond_index == mol, 1, 0)
          scopes.append(
              [
                  int(np.argmax(positions)),
                  int(np.count_nonzero(positions)),
              ]
          )
      return scopes
  
file_path: deepchem/deepchem/utils/grover.py
imports: import numpy
  from typing import List, Any
  from numpy.typing import ArrayLike
  from deepchem.feat.graph_data import BatchGraphData, GraphData
  from deepchem.feat.molecule_featurizers.dmpnn_featurizer import GraphConvConstants
label_desc: Use image node_id 2 for calling a global function with example usage: _get_bond_scopes(edge_index, graph_index) and returns: scopes