code: def CopyRecord(record, **field_overrides):
      
  
      fields = field_overrides
      for field in record.__slots__:
          if field in field_overrides:
              continue
          value = getattr(record, field)
          if isinstance(value, RecordClass):
              # Recurse for records.
              new_value = CopyRecord(value)
          else:
              new_value = copy.copy(value)
          fields[field] = new_value
  
      return type(record)(**fields)
docs: Copies a record and its fields, recurses for any field that is a Record.
      
      For records that have nested mutable fields, use copy.deepcopy.
      
      Args:
        record: A Record instance to be copied.
        **field_overrides: Fields and their values to override in the new copy.
  
      Returns: A copy of the given record with any fields overridden.