code: def _dfs(
      used_partitions: Set[int],
      current_partition: int,
      bond: Tuple[int, int],
      components: List[List[int]],
      rotatable_bonds: List[Tuple[int, int]],
      lines: List[str],
      pdb_map: Dict[int, str],
      comp_map: Dict[int, int],
  ) -> List[str]:
      """
      This function does a depth first search through the torsion tree
  
      Parameters
      ----------
      used_partions: Set[int]
          Partitions which have already been used
      current_partition: int
          The current partition to expand
      bond: Tuple[int, int]
          the bond which goes from the previous partition into this partition
      components: List[List[int]]
          List of connected components
      rotatable_bonds: List[Tuple[int, int]]
          List of rotatable bonds. This tuple is (from_atom, to_atom).
      lines: List[str]
          List of lines to write
      pdb_map: Dict[int, str]
          Maps atom numbers to PDBQT lines to write
      comp_map: Dict[int, int]
          Maps atom numbers to component numbers
  
      Returns
      -------
      lines: List[str]
          List of lines to write. This has more appended lines.
      """
      if comp_map[bond[1]] != current_partition:
          bond = (bond[1], bond[0])
      used_partitions.add(comp_map[bond[0]])
      used_partitions.add(comp_map[bond[1]])
      lines.append("BRANCH %4s %4s\n" % (bond[0] + 1, bond[1] + 1))
      for atom in components[current_partition]:
          lines.append(pdb_map[atom])
      for b in rotatable_bonds:
          valid, next_partition = _valid_bond(
              used_partitions, b, current_partition, comp_map
          )
          if not valid:
              continue
          lines = _dfs(
              used_partitions,
              next_partition,
              b,
              components,
              rotatable_bonds,
              lines,
              pdb_map,
              comp_map,
          )
      lines.append("ENDBRANCH %4s %4s\n" % (bond[0] + 1, bond[1] + 1))
      return lines
  
file_path: deepchem/deepchem/utils/pdbqt_utils.py
imports: from typing import Dict, List, Optional, Set, Tuple
  from deepchem.utils.typing import RDKitMol
label_desc: Use image node_id 8 for calling a global function with example usage: _dfs(used_partitions, current_partition, bond, components, rotatable_bonds, lines, pdb_map, comp_map) and returns: lines