code: def replace_keys(record: Mapping, key_map: Mapping) -> dict:
      
  
      return {key_map[k]: v for k, v in record.items() if k in key_map}
docs: New record with renamed keys including keys only found in key_map.