code: def decompress_file(archive, dir_, leading_directories="strip"):
      """Decompress `archive` into a directory `dir_`
  
      Parameters
      ----------
      archive: str
      dir_: str
      leading_directories: {'strip', None}
        If `strip`, and archive contains a single leading directory under which
        all content is stored, all the content will be moved one directory up
        and that leading directory will be removed.
      """
      if not exists(dir_):
          lgr.debug(
              "Creating directory %s to extract archive into", dir_
          )
          os.makedirs(dir_)
  
      _decompress_file(archive, dir_)
  
      if leading_directories == "strip":
          _, dirs, files = next(os.walk(dir_))
          if not len(files) and len(dirs) == 1:
              # move all the content under dirs[0] up 1 level
              widow_dir = opj(dir_, dirs[0])
              lgr.debug("Moving content within %s upstairs", widow_dir)
              subdir, subdirs_, files_ = next(
                  os.walk(opj(dir_, dirs[0]))
              )
              for f in subdirs_ + files_:
                  os.rename(opj(subdir, f), opj(dir_, f))
              # NFS might hold it victim so use rmtree so it tries a few times
              rmtree(widow_dir)
      elif leading_directories is None:
          pass  # really do nothing
      else:
          raise NotImplementedError(
              "Not supported %s" % leading_directories
          )
  
imports: import hashlib
  import logging
  import os
  import random
  import string
  import tempfile
  from datalad import cfg
  from datalad.config import anything2bool
  from datalad.consts import ARCHIVES_TEMP_DIR
  from datalad.support.external_versions import external_versions
  from datalad.support.locking import lock_if_check_fails
  from datalad.support.path import abspath, exists, isabs, isdir
  from datalad.support.path import join
  from datalad.support.path import normpath, pardir, relpath
  from datalad.support.path import sep
  from datalad.utils import Path, any_re_search, ensure_bytes, ensure_unicode, get_tempfile_kwargs, on_windows, rmtemp, rmtree, unlink
label_desc: Use image node_id 1 for calling a global function with example usage: decompress_file(archive, dir_, leading_directories) without return types