[docs]defdata_diffs(source_data,target_data,fields=None):""" Find all (relevant) fields with differing values between the two data records, source and target. :param source_data: Dict of normalized record from source data. :param target_data: Dict of normalized record from target data. :param fields: Optional list of fields to check. If not specified, all fields present in ``target_data`` will be checked. :returns: Possibly empty list of field names which were found to differ between source and target record. """iffieldsisNone:fields=list(target_data)diffs=[]forfieldinfields:iffieldnotintarget_data:raiseKeyError(f"field '{field}' is missing from target_data")iffieldnotinsource_data:raiseKeyError(f"field '{field}' is missing from source_data")target_value=target_data[field]source_value=source_data[field]iftarget_value!=source_value:diffs.append(field)returndiffs