code: def serialize(self, pid, record, links_factory=None, **kwargs):
          
          return json.dumps(
              self.transform_record(pid, record, links_factory, **kwargs),
              **self._format_args())
docs: Serialize a single record and persistent identifier.
  
          :param pid: Persistent identifier instance.
          :param record: Record instance.
          :param links_factory: Factory function for record links.