code: def enum_attach(ctr_mol, nei_node, amap, singletons):
      nei_mol, nei_idx = nei_node.mol, nei_node.nid
      att_confs = []
      black_list = [
          atom_idx
          for nei_id, atom_idx, _ in amap
          if nei_id in singletons
      ]
      ctr_atoms = [
          atom
          for atom in ctr_mol.GetAtoms()
          if atom.GetIdx() not in black_list
      ]
      ctr_bonds = [bond for bond in ctr_mol.GetBonds()]
  
      if nei_mol.GetNumBonds() == 0:  # neighbor singleton
          nei_atom = nei_mol.GetAtomWithIdx(0)
          used_list = [atom_idx for _, atom_idx, _ in amap]
          for atom in ctr_atoms:
              if (
                  atom_equal(atom, nei_atom)
                  and atom.GetIdx() not in used_list
              ):
                  new_amap = amap + [(nei_idx, atom.GetIdx(), 0)]
                  att_confs.append(new_amap)
  
      elif nei_mol.GetNumBonds() == 1:  # neighbor is a bond
          bond = nei_mol.GetBondWithIdx(0)
          bond_val = int(bond.GetBondTypeAsDouble())
          b1, b2 = bond.GetBeginAtom(), bond.GetEndAtom()
  
          for atom in ctr_atoms:
              # Optimize if atom is carbon (other atoms may change valence)
              if (
                  atom.GetAtomicNum() == 6
                  and atom.GetTotalNumHs() < bond_val
              ):
                  continue
              if atom_equal(atom, b1):
                  new_amap = amap + [
                      (nei_idx, atom.GetIdx(), b1.GetIdx())
                  ]
                  att_confs.append(new_amap)
              elif atom_equal(atom, b2):
                  new_amap = amap + [
                      (nei_idx, atom.GetIdx(), b2.GetIdx())
                  ]
                  att_confs.append(new_amap)
      else:
          # intersection is an atom
          for a1 in ctr_atoms:
              for a2 in nei_mol.GetAtoms():
                  if atom_equal(a1, a2):
                      # Optimize if atom is carbon (other atoms may change valence)
                      if (
                          a1.GetAtomicNum() == 6
                          and a1.GetTotalNumHs() + a2.GetTotalNumHs()
                          < 4
                      ):
                          continue
                      new_amap = amap + [
                          (nei_idx, a1.GetIdx(), a2.GetIdx())
                      ]
                      att_confs.append(new_amap)
  
          # intersection is an bond
          if ctr_mol.GetNumBonds() > 1:
              for b1 in ctr_bonds:
                  for b2 in nei_mol.GetBonds():
                      if ring_bond_equal(b1, b2):
                          new_amap = amap + [
                              (
                                  nei_idx,
                                  b1.GetBeginAtom().GetIdx(),
                                  b2.GetBeginAtom().GetIdx(),
                              ),
                              (
                                  nei_idx,
                                  b1.GetEndAtom().GetIdx(),
                                  b2.GetEndAtom().GetIdx(),
                              ),
                          ]
                          att_confs.append(new_amap)
  
                      if ring_bond_equal(b1, b2, reverse=True):
                          new_amap = amap + [
                              (
                                  nei_idx,
                                  b1.GetBeginAtom().GetIdx(),
                                  b2.GetEndAtom().GetIdx(),
                              ),
                              (
                                  nei_idx,
                                  b1.GetEndAtom().GetIdx(),
                                  b2.GetBeginAtom().GetIdx(),
                              ),
                          ]
                          att_confs.append(new_amap)
      return att_confs
  
imports: import rdkit
  import rdkit.Chem
  from scipy.sparse import csr_matrix
  from scipy.sparse.csgraph import minimum_spanning_tree
  from collections import defaultdict
  from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions
  from .vocab import Vocab
label_desc: Use image node_id 14 for calling a global function with example usage: enum_attach(ctr_mol, nei_node, amap, singletons) and returns: att_confs