code: def _apply_changes(self):
          
          if self.mark:
              self[QName(XMP_NS_XMP, 'MetadataDate')] = datetime.now().isoformat()
              self[QName(XMP_NS_PDF, 'Producer')] = 'pikepdf ' + pikepdf_version
          xml = self._get_xml_bytes()
          self._pdf.Root.Metadata = Stream(self._pdf, xml)
          self._pdf.Root.Metadata[Name.Type] = Name.Metadata
          self._pdf.Root.Metadata[Name.Subtype] = Name.XML
          if self.sync_docinfo:
              self._update_docinfo()
docs: Serialize our changes back to the PDF in memory
  
          Depending how we are initialized, leave our metadata mark and producer.