class_docstr: Helper utils for Model Archiver tool.
  This class lists out all the methods such as validations for model archiving.
docstr: Create a model-archive
  :param archive_format:
  :param export_file:
  :param model_name:
  :param model_path
  :param manifest:
  :return:
docstr_tok: ["Create","a","model-archive",":","param","archive_format",":",":","param","export_file",":",":","param","model_name",":",":","param","model_path",":","param","manifest",":",":","return",":"]
code: def archive(
      export_file,
      model_name,
      model_path,
      manifest,
      archive_format="default",
  ):
      """
      Create a model-archive
      :param archive_format:
      :param export_file:
      :param model_name:
      :param model_path
      :param manifest:
      :return:
      """
      mar_path = ModelExportUtils.get_archive_export_path(
          export_file, model_name, archive_format
      )
      try:
          if archive_format == "tgz":
              with tarfile.open(mar_path, "w:gz") as z:
                  ModelExportUtils.archive_dir(
                      model_path, z, archive_format, model_name
                  )
                  # Write the manifest here now as a json
                  tar_manifest = tarfile.TarInfo(
                      name=os.path.join(
                          model_name, MAR_INF, MANIFEST_FILE_NAME
                      )
                  )
                  tar_manifest.size = len(manifest.encode("utf-8"))
                  z.addfile(
                      tarinfo=tar_manifest,
                      fileobj=BytesIO(manifest.encode()),
                  )
                  z.close()
          elif archive_format == "no-archive":
              if model_path != mar_path:
                  # Copy files to export path if
                  ModelExportUtils.archive_dir(
                      model_path, mar_path, archive_format, model_name
                  )
              # Write the MANIFEST in place
              manifest_path = os.path.join(mar_path, MAR_INF)
              ModelExportUtils.make_dir(manifest_path)
              with open(
                  os.path.join(manifest_path, MANIFEST_FILE_NAME), "w"
              ) as f:
                  f.write(manifest)
          else:
              zip_mode = (
                  zipfile.ZIP_STORED
                  if archive_format == "zip-store"
                  else zipfile.ZIP_DEFLATED
              )
              with zipfile.ZipFile(mar_path, "w", zip_mode) as z:
                  ModelExportUtils.archive_dir(
                      model_path, z, archive_format, model_name
                  )
                  # Write the manifest here now as a json
                  z.writestr(
                      os.path.join(MAR_INF, MANIFEST_FILE_NAME),
                      manifest,
                  )
      except IOError:
          logging.error(
              'Failed to save the model-archive to model-path "%s". '
              "Check the file permissions and retry.",
              export_file,
          )
          raise
      except:
          logging.error(
              "Failed to convert %s to the model-archive.", model_name
          )
          raise
  
imports: import glob
  import logging
  import os
  import re
  import shutil
  import tarfile
  import tempfile
  import zipfile
  from io import BytesIO
  from pathlib import Path
  from .manifest_components.manifest import Manifest
  from .manifest_components.model import Model
  from .model_archiver_config import ModelArchiverConfig
  from .model_archiver_error import ModelArchiverError
label_desc: Use image node_id 9 for calling the ModelExportUtils obj's underlying member method code with example usage: obj.archive(export_file, model_name, model_path, manifest, archive_format) without return types