code: def get_heteroatoms(self, elements=None):
          
  
          heteroatoms = set()
  
          for node in self.molgraph.graph.nodes():
              if elements is not None:
                  if str(self.species[node]) in elements:
                      heteroatoms.add(node)
              else:
                  if str(self.species[node]) not in ["C", "H"]:
                      heteroatoms.add(node)
  
          return heteroatoms
docs: Identify non-H, non-C atoms in the MoleculeGraph, returning a list of
          their node indices.
  
          :param elements: List of elements to identify (if only certain
              functional groups are of interest).
          :return: set of ints representing node indices