code: def is_hidden(abs_path, abs_root=""):
      """Is a file hidden or contained in a hidden directory?
  
      This will start with the rightmost path element and work backwards to the
      given root to see if a path is hidden or in a hidden directory. Hidden is
      determined by either name starting with '.' or the UF_HIDDEN flag as
      reported by stat.
  
      If abs_path is the same directory as abs_root, it will be visible even if
      that is a hidden folder. This only checks the visibility of files
      and directories *within* abs_root.
  
      Parameters
      ----------
      abs_path : unicode
          The absolute path to check for hidden directories.
      abs_root : unicode
          The absolute path of the root directory in which hidden directories
          should be checked for.
      """
      if os.path.normpath(abs_path) == os.path.normpath(abs_root):
          return False
  
      if is_file_hidden(abs_path):
          return True
  
      if not abs_root:
          abs_root = abs_path.split(os.sep, 1)[0] + os.sep
      inside_root = abs_path[len(abs_root) :]
      if any(
          part.startswith(".") for part in inside_root.split(os.sep)
      ):
          return True
  
      # check UF_HIDDEN on any location up to root.
      # is_file_hidden() already checked the file, so start from its parent dir
      path = os.path.dirname(abs_path)
      while path and path.startswith(abs_root) and path != abs_root:
          if not exists(path):
              path = os.path.dirname(path)
              continue
          try:
              # may fail on Windows junctions
              st = os.lstat(path)
          except OSError:
              return True
          if getattr(st, "st_flags", 0) & UF_HIDDEN:
              return True
          path = os.path.dirname(path)
  
      return False
  
imports: import os
  import sys
  import stat
  import errno
  import tempfile
  import warnings
  from ipython_genutils import py3compat
  from contextlib import contextmanager
  from distutils.util import strtobool
  from ipython_genutils import py3compat
label_desc: Use image node_id 11 for calling a global function with example usage: is_hidden(abs_path, abs_root) and returns: False, False, True, True, True, True