code: def write_zip(self, resources=None, dumpfile=None):
          
          compression = (ZIP_DEFLATED if self.compress else ZIP_STORED)
          zf = ZipFile(
              dumpfile,
              mode="w",
              compression=compression,
              allowZip64=True)
          # Write resources first
          rdm = ResourceDumpManifest(resources=resources)
          real_path = {}
          for resource in resources:
              archive_path = self.archive_path(resource.path)
              real_path[archive_path] = resource.path
              resource.path = archive_path
          zf.writestr('manifest.xml', rdm.as_xml())
          # Add all files in the resources
          for resource in resources:
              zf.write(real_path[resource.path], arcname=resource.path)
          zf.close()
          zipsize = os.path.getsize(dumpfile)
          self.logger.info(
              "Wrote ZIP file dump %s with size %d bytes" %
              (dumpfile, zipsize))
docs: Write a ZIP format dump file.
  
          Writes a ZIP file containing the resources in the iterable resources along with
          a manifest file manifest.xml (written first). No checks on the size of files
          or total size are performed, this is expected to have been done beforehand.