code: def clear_cache(tmp):
      """Check that cache directory is empty.
  
      Checks that a specified directory do not contain any directories with
      the ML-Ensemble temporary cache signature. Attempts to remove any found
      directories.
  
      Parameters
      ----------
      tmp : str
          the directory to check for residual caches in.
      """
      global _PREFIX
      residuals = [
          i
          for i in os.walk(tmp)
          if os.path.split(i[0])[-1].startswith(_PREFIX)
      ]
  
      n = len(residuals)
      if n > 0:
          print(
              "[MLENS] Found %i residual cache(s):" % n, file=sys.stderr
          )
  
          size = 0
          for i, res in enumerate(residuals):
              s = os.path.getsize(res[0])
              size += s
  
              print(
                  "        %i (%i): %s" % (i + 1, s, res[0]),
                  file=sys.stderr,
              )
  
          print(
              "        Total size: %i\n[MLENS] Removing..." % size,
              end=" ",
              file=sys.stderr,
          )
  
          for res in residuals:
              try:
                  shutil.rmtree(res[0])
              except OSError:
                  try:
                      subprocess.Popen(
                          "rmdir /S /Q %s" % res[0],
                          shell=True,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE,
                      )
                  except OSError:
                      warnings.warn(
                          "Failed to delete cache at %s." % res[0]
                      )
          print("done.", file=sys.stderr)
  
imports: from __future__ import print_function
  import os
  import sys
  import shutil
  import tempfile
  import warnings
  import sysconfig
  import subprocess
  from multiprocessing import current_process
  import numpy
label_desc: Use image node_id 14 for calling a global function with example usage: clear_cache(tmp) without return types