There was a question with some python code that processed data and I was asked to refactor it.
Refactor the data-processing logic without changing its intended behavior: combine records with the same id by summing their amount values, and return results in the order each ID first appears. Implement def refactor_records(records):.
Input is a list of dictionaries containing a string id and integer amount. Return a list of dictionaries containing id and total.
def refactor_records(records):