How would you implement a function to deduplicate records in a dataset for Disney Experiences?
Implement deduplicate_records(records, key). records is a list of dictionaries, and key is a field present in every dictionary. Records with the same value for key are duplicates. Return a new list containing the first record for each unique key value, preserving original order.
Return an empty list when records is empty. Do not modify the input list or its record dictionaries.
def deduplicate_records(records, key):