code: def elements(self):
          
          tmp_formula = self.formula
          if tmp_formula is None:
              return {}
          # necessary for some old pickles which use the deprecated
          # Formula class
          tmp_formula = str(self.formula)
          # commonly occurring characters in incorrectly constructed formulas
          if "*" in tmp_formula:
              warn("invalid character '*' found in formula '%s'" % self.formula)
              tmp_formula = tmp_formula.replace("*", "")
          if "(" in tmp_formula or ")" in tmp_formula:
              warn("invalid formula (has parenthesis) in '%s'" % self.formula)
              return None
          composition = {}
          parsed = element_re.findall(tmp_formula)
          for (element, count) in parsed:
              if count == '':
                  count = 1
              else:
                  try:
                      count = float(count)
                      int_count = int(count)
                      if count == int_count:
                          count = int_count
                      else:
                          warn("%s is not an integer (in formula %s)" %
                               (count, self.formula))
                  except ValueError:
                      warn("failed to parse %s (in formula %s)" %
                           (count, self.formula))
                      return None
              if element in composition:
                  composition[element] += count
              else:
                  composition[element] = count
          return composition
docs: Dictionary of elements as keys and their count in the metabolite
          as integer. When set, the `formula` property is update accordingly