code: def _rmtree_unsafe(path, onerror):
      try:
          with os.scandir(path) as scandir_it:
              entries = list(scandir_it)
      except OSError:
          onerror(os.scandir, path, sys.exc_info())
          entries = []
      for entry in entries:
          fullname = entry.path
          if _rmtree_isdir(entry):
              try:
                  if entry.is_symlink():
                      # This can only happen if someone replaces
                      # a directory with a symlink after the call to
                      # os.scandir or entry.is_dir above.
                      raise OSError(
                          "Cannot call rmtree on a symbolic link"
                      )
              except OSError:
                  onerror(os.path.islink, fullname, sys.exc_info())
                  continue
              _rmtree_unsafe(fullname, onerror)
          else:
              try:
                  os.unlink(fullname)
              except OSError:
                  onerror(os.unlink, fullname, sys.exc_info())
      try:
          os.rmdir(path)
      except OSError:
          onerror(os.rmdir, path, sys.exc_info())
  
imports: import os
  import sys
  import stat
  import fnmatch
  import collections
  import errno
label_desc: Use image node_id 16 for calling a global function with example usage: _rmtree_unsafe(path, onerror) without return types