code: def uncompress_file(file_, delete_archive=True, verbose=1):
      """Uncompress files contained in a data_set.
  
      Parameters
      ----------
      file_ : string
          Path of file to be uncompressed.
  
      delete_archive : bool, default=True
          Whether or not to delete archive once it is uncompressed.
      %(verbose)s
  
      Notes
      -----
      This handles zip, tar, gzip and bzip files only.
  
      """
      if verbose > 0:
          sys.stderr.write(f"Extracting data from {file_}...")
      data_dir = os.path.dirname(file_)
      # We first try to see if it is a zip file
      try:
          filename, ext = os.path.splitext(file_)
          with open(file_, "rb") as fd:
              header = fd.read(4)
          processed = False
          if zipfile.is_zipfile(file_):
              z = zipfile.ZipFile(file_)
              z.extractall(path=data_dir)
              z.close()
              if delete_archive:
                  os.remove(file_)
              file_ = filename
              processed = True
          elif ext == ".gz" or header.startswith(b"\x1f\x8b"):
              import gzip
  
              if ext == ".tgz":
                  filename = f"{filename}.tar"
              elif ext == "":
                  # We rely on the assumption that gzip files have an extension
                  shutil.move(file_, f"{file_}.gz")
                  file_ = f"{file_}.gz"
              with gzip.open(file_) as gz:
                  with open(filename, "wb") as out:
                      shutil.copyfileobj(gz, out, 8192)
              # If file is .tar.gz, this will be handled in the next case
              if delete_archive:
                  os.remove(file_)
              file_ = filename
              processed = True
          if os.path.isfile(file_) and tarfile.is_tarfile(file_):
              with contextlib.closing(tarfile.open(file_, "r")) as tar:
                  _safe_extract(tar, path=data_dir)
              if delete_archive:
                  os.remove(file_)
              processed = True
          if not processed:
              raise OSError(
                  f"[Uncompress] unknown archive file format: {file_}"
              )
  
          if verbose > 0:
              sys.stderr.write(".. done.\n")
      except Exception as e:
          if verbose > 0:
              print(f"Error uncompressing file: {e}")
          raise
  
imports: import collections.abc
  import contextlib
  import fnmatch
  import hashlib
  import os
  import pickle
  import shutil
  import sys
  import tarfile
  import time
  import urllib
  import warnings
  import zipfile
  from pathlib import Path
  import numpy
  import requests
  from .._utils import fill_doc
  from .utils import get_data_dirs
label_desc: Use image node_id 12 for calling a global function with example usage: uncompress_file(file_, delete_archive, verbose) without return types