docs: def _reaction_to_dicts(reaction):
      """Convert a reaction to reduced left, right dictionaries.
  
      Returns a pair of (left, right) dictionaries mapping compounds to
      normalized integer stoichiometric values. If a compound occurs multiple
      times on one side, the occurences are combined into a single entry in the
      dictionary.
      """
      def dict_from_iter_sum(it, div):
          d = {}
          for k, v in it:
              if k not in d:
                  d[k] = 0
              d[k] += int(v / div)
          return d
  
      div = reduce(gcd, (abs(v) for _, v in reaction.compounds), 0)
      if div == 0:
          raise ValueError('Empty reaction')
  
      left = dict_from_iter_sum(reaction.left, div)
      right = dict_from_iter_sum(reaction.right, div)
  
      return left, right