code: def remove_tree_safe(path):
      try:
          st = os.lstat(path)
          if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode):
              os.remove(path)
          elif stat.S_ISDIR(st.st_mode):
              shutil.rmtree(fix_path_encoding(path), ignore_errors=True)
      # XXX
      except UnicodeDecodeError as e:
          logging.exception(
              "remove_tree_safe with argument %s raise exception: %s",
              path,
              e,
          )
          raise
      except OSError:
          pass
  
imports: import codecs
  import errno
  import logging
  import os
  import random
  import shutil
  import six
  import stat
  import sys
  import library.python.func
  import library.python.strings
  import library.python.windows
label_desc: Use image node_id 10 for calling a global function with example usage: remove_tree_safe(path) without return types