code: def reduce_molecular_complex_to_contacts(
      fragments: List[Tuple[np.ndarray, RDKitMol]], cutoff: float = 4.5
  ) -> List[Tuple[np.ndarray, MolecularFragment]]:
      """Reduce a molecular complex to only those atoms near a contact.
  
      Molecular complexes can get very large. This can make it unwieldy to
      compute functions on them. To improve memory usage, it can be very
      useful to trim out atoms that aren't close to contact regions. This
      function takes in a molecular complex and returns a new molecular
      complex representation that contains only contact atoms. The contact
      atoms are computed by calling `get_contact_atom_indices` under the
      hood.
  
      Parameters
      ----------
      fragments: List[Tuple[np.ndarray, rdkit.Chem.rdchem.Mol]]
          As returned by `rdkit_utils.load_complex`, a list of tuples of
          `(coords, mol)` where `coords` is a `(N_atoms, 3)` array and `mol`
          is the rdkit molecule object.
      cutoff: float
          The cutoff distance in angstroms.
  
      Returns
      -------
      List[Tuple[np.ndarray, MolecularFragment]]
          A list of length `len(molecular_complex)`. Each entry in this list
          is a tuple of `(coords, MolecularFragment)`. The coords is stripped
          down to `(N_contact_atoms, 3)` where `N_contact_atoms` is the number
          of contact atoms for this complex. `MolecularFragment` is used since
          it's tricky to make a RDKit sub-molecule.
      """
      atoms_to_keep = get_contact_atom_indices(fragments, cutoff)
      reduced_complex = []
      for frag, keep in zip(fragments, atoms_to_keep):
          contact_frag = get_mol_subset(frag[0], frag[1], keep)
          reduced_complex.append(contact_frag)
      return reduced_complex
  
imports: import itertools
  import numpy
  from typing import List, Optional, Sequence, Set, Tuple, Union
  import logging
  from deepchem.utils.typing import RDKitAtom, RDKitMol
  from deepchem.utils.geometry_utils import compute_pairwise_distances
label_desc: Use image node_id 6 for calling a global function with example usage: reduce_molecular_complex_to_contacts(fragments, cutoff) and returns: reduced_complex