code: def apply(diff, recs, strict=True):
      
      index_columns = diff['_index']
      indexed = records.index(copy.deepcopy(list(recs)), index_columns)
      _add_records(indexed, diff['added'], index_columns, strict=strict)
      _remove_records(indexed, diff['removed'], index_columns, strict=strict)
      _update_records(indexed, diff['changed'], strict=strict)
      return records.sort(indexed.values())
docs: Transform the records with the patch. May fail if the records do not
      match those expected in the patch.