class_docstr: Helper utils for Model Archiver tool.
  This class lists out all the methods such as validations for model archiving.
docstr: copy model artifacts in a common model directory for archiving
  :param model_name: name of model being archived
  :param kwargs: key value pair of files to be copied in archive
  :return:
docstr_tok: ["copy","model","artifacts","in","a","common","model","directory","for","archiving",":","param","model_name",":","name","of","model","being","archived",":","param","kwargs",":","key","value","pair","of","files","to","be","copied","in","archive",":","return",":"]
code: def copy_artifacts(model_name, **kwargs):
      """
      copy model artifacts in a common model directory for archiving
      :param model_name: name of model being archived
      :param kwargs: key value pair of files to be copied in archive
      :return:
      """
      model_path = os.path.join(tempfile.gettempdir(), model_name)
      if os.path.exists(model_path):
          shutil.rmtree(model_path)
      ModelExportUtils.make_dir(model_path)
      for file_type, path in kwargs.items():
          if path:
              if file_type == "handler":
                  if path in model_handlers.keys():
                      continue
  
                  if ".py" not in path:
                      path = (
                          path.split(":")[0] if ":" in path else path
                      ) + ".py"
  
              if file_type == "extra_files":
                  for path_or_wildcard in path.split(","):
                      if not Path(path_or_wildcard).exists():
                          raise FileNotFoundError(
                              f"File does not exist: {path_or_wildcard}"
                          )
                      for file in glob.glob(path_or_wildcard.strip()):
                          if os.path.isfile(file):
                              shutil.copy2(file, model_path)
                          elif (
                              os.path.isdir(file) and file != model_path
                          ):
                              for item in os.listdir(file):
                                  src = os.path.join(file, item)
                                  dst = os.path.join(model_path, item)
                                  if os.path.isfile(src):
                                      shutil.copy2(src, dst)
                                  elif os.path.isdir(src):
                                      shutil.copytree(
                                          src, dst, False, None
                                      )
                          else:
                              raise ValueError(
                                  f"Invalid extra file given {file}"
                              )
              else:
                  shutil.copy(path, model_path)
  
      return model_path
  
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 8 for calling the ModelExportUtils obj's underlying member method code with example usage: obj.copy_artifacts(model_name) and returns: model_path