code: def whichchain(atom):
      
      atom = atom if not isinstance(atom, Atom) else atom.OBAtom  # Convert to OpenBabel Atom
      return atom.GetResidue().GetChain() if atom.GetResidue() is not None else None
docs: Returns the residue number of an PyBel or OpenBabel atom.