code: def safe_index(l, e):
      """Gets the index of e in l, providing an index of len(l) if not found
  
      Parameters
      ----------
      l: list
          List of values
      e: object
          Object to check whether `e` is in `l`
  
      Examples
      --------
      >>> dc.feat.graph_features.safe_index([1, 2, 3], 1)
      0
      >>> dc.feat.graph_features.safe_index([1, 2, 3], 7)
      3
  
      """
      try:
          return l.index(e)
      except ValueError:
          return len(l)
  
imports: import numpy
  import deepchem
  from deepchem.feat.base_classes import MolecularFeaturizer
  from deepchem.feat.mol_graphs import ConvMol, WeaveMol
  from deepchem.data import DiskDataset
  import logging
  from typing import Optional, List, Tuple, Union, Iterable
  from deepchem.utils.typing import RDKitMol, RDKitAtom
  from deepchem.utils.molecule_feature_utils import one_hot_encode
label_desc: Use image node_id 4 for calling a global function with example usage: safe_index(l, e) and returns: l, len