code: def patch_file(patch_stream: TextIO, fromcsv_stream: TextIO, tocsv_stream: TextIO,
                 strict: bool = True, sep: str = ','):
      
      diff = patch.load(patch_stream)
  
      from_records = records.load(fromcsv_stream, sep=sep)
      to_records = patch.apply(diff, from_records, strict=strict)
  
      # what order should the columns be in?
      if to_records:
          # have data, use a nice ordering
          all_columns = to_records[0].keys()
          index_columns = diff['_index']
          fieldnames = _nice_fieldnames(all_columns, index_columns)
      else:
          # no data, use the original order
          fieldnames = from_records.fieldnames
  
      records.save(to_records, fieldnames, tocsv_stream)
docs: Apply the patch to the source CSV file, and save the result to the target
      file.