code: def patch(self, pid, record, **kwargs):
          
          data = self.loaders[request.mimetype]()
          if data is None:
              raise InvalidDataRESTError()
  
          self.check_etag(str(record.revision_id))
          try:
              record = record.patch(data)
          except (JsonPatchException, JsonPointerException):
              raise PatchJSONFailureRESTError()
  
          record.commit()
          db.session.commit()
          if self.indexer_class:
              self.indexer_class().index(record)
  
          return self.make_response(
              pid, record, links_factory=self.links_factory)
docs: Modify a record.
  
          Permissions: ``update_permission_factory``
  
          The data should be a JSON-patch, which will be applied to the record.
          Requires header ``Content-Type: application/json-patch+json``.
  
          Procedure description:
  
          #. The record is deserialized using the proper loader.
  
          #. The ETag is checked.
  
          #. The record is patched.
  
          #. The HTTP response is built with the help of the link factory.
  
          :param pid: Persistent identifier for record.
          :param record: Record object.
          :returns: The modified record.