code: def _combine_transfers(self, result):
          
          transfers = {}
          for reaction_id, c1, c2, form in result:
              key = reaction_id, c1, c2
              combined_form = transfers.setdefault(key, Formula())
              transfers[key] = combined_form | form
  
          for (reaction_id, c1, c2), form in iteritems(transfers):
              yield reaction_id, c1, c2, form
docs: Combine multiple pair transfers into one.