code: def save_multiple_parts_file(filename, format="gztar"):
      """Save multiple parts file
  
      Implementation process:
          1. get the absolute path to 'filename'
          2. create a 'filename' directory
          3. user does something with file_path('filename/')
          4. remove 'filename' directory
          5. make_archive 'filename' directory, and rename 'archive file' to filename
  
      :param filename: result model path
      :param format: archive format: one of "zip", "tar", "gztar", "bztar", or "xztar"
      :return: real model path
  
      Usage::
  
          >>> # The following code will create an archive file('~/tmp/test_file') containing 'test_doc_i'(i is 0-10) files.
          >>> with save_multiple_parts_file('~/tmp/test_file') as filename_dir:
          ...   for i in range(10):
          ...       temp_path = os.path.join(filename_dir, 'test_doc_{}'.format(str(i)))
          ...       with open(temp_path) as fp:
          ...           fp.write(str(i))
          ...
  
      """
  
      if filename.startswith("~"):
          filename = os.path.expanduser(filename)
  
      file_path = os.path.abspath(filename)
  
      # Create model dir
      if os.path.exists(file_path):
          raise FileExistsError(
              "ERROR: file exists: {}, cannot be create the directory.".format(
                  file_path
              )
          )
  
      os.makedirs(file_path)
  
      # return model dir
      yield file_path
  
      # filename dir to filename.tar.gz file
      tar_file = shutil.make_archive(
          file_path, format=format, root_dir=file_path
      )
  
      # Remove filename dir
      if os.path.exists(file_path):
          shutil.rmtree(file_path)
  
      # filename.tar.gz rename to filename
      os.rename(tar_file, file_path)
  
file_path: qlib/qlib/utils/file.py
imports: import os
  import shutil
  import tempfile
  import contextlib
  from typing import Optional, Text, IO, Union
  from pathlib import Path
  from qlib.log import get_module_logger
label_desc: Use image node_id 2 for calling a global function with example usage: save_multiple_parts_file(filename, format) without return types