code: def decompress_file(archive, dir_):
      """Decompress `archive` into a directory `dir_`
  
      Parameters
      ----------
      archive: str
      dir_: str
      """
      with swallow_outputs() as cmo:
          archive = ensure_bytes(archive)
          dir_ = ensure_bytes(dir_)
          patoolib.util.check_existing_filename(archive)
          patoolib.util.check_existing_filename(dir_, onlyfiles=False)
          # Call protected one to avoid the checks on existence on unixified path
          outdir = unixify_path(dir_)
          # should be supplied in PY3 to avoid b''
          outdir = ensure_unicode(outdir)
          archive = ensure_unicode(archive)
  
          format_compression = patoolib.get_archive_format(archive)
          if format_compression == ("gzip", None):
              # Yarik fell into the trap of being lazy and not providing proper
              # support for .gz .xz etc "stream archivers" formats in handling
              # of archives. ATM out support for .gz relies on behavior of 7z while
              # extracting them and respecting possibly present .gz filename
              # header field.
              # See more https://github.com/datalad/datalad/pull/3176#issuecomment-466819861
              # TODO: provide proper handling of all those archives without
              # relying on any filename been stored in the header
              program = patoolib.find_archive_program(
                  format_compression[0], "extract"
              )
              if basename(program) != "7z":
                  raise MissingExternalDependency(
                      "cmd:7z",
                      msg="(Not) Funny enough but ATM we need p7zip installation "
                      "to handle .gz files extraction 'correctly'",
                  )
  
          patoolib._extract_archive(
              unixify_path(archive), outdir=outdir, verbosity=100
          )
          if cmo.out:
              lgr.debug("patool gave stdout:\n%s", cmo.out)
          if cmo.err:
              lgr.debug("patool gave stderr:\n%s", cmo.err)
  
      # Note: (ben) Experienced issue, where extracted tarball
      # lacked execution bit of directories, leading to not being
      # able to delete them while having write permission.
      # Can't imagine a situation, where we would want to fail on
      # that kind of mess. So, to be sure set it.
  
      if not on_windows:
          os.chmod(dir_, os.stat(dir_).st_mode | os.path.stat.S_IEXEC)
          for root, dirs, files in os.walk(dir_, followlinks=False):
              for d in dirs:
                  subdir = opj(root, d)
                  os.chmod(
                      subdir,
                      os.stat(subdir).st_mode | os.path.stat.S_IEXEC,
                  )
  
file_path: datalad/datalad/support/archive_utils_patool.py
imports: import patoolib
  from .external_versions import external_versions
  import os
  from .exceptions import MissingExternalDependency
  from .path import basename, join
  from datalad.utils import ensure_bytes, chpwd
  import logging
  import patoolib.util
  from ..support.exceptions import CommandError
  from ..utils import swallow_outputs
  from datalad.cmd import WitlessRunner, StdOutErrCapture
  from ..utils import ensure_unicode
  from ..utils import on_windows
label_desc: Use image node_id 3 for calling a global function with example usage: decompress_file(archive, dir_) without return types