code: def is_hidden(abs_path: str, abs_root: str = "") -> bool:
      """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.
      """
      abs_path = os.path.normpath(abs_path)
      abs_root = os.path.normpath(abs_root)
  
      if abs_path == 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 Path(inside_root).parts):
          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 = str(Path(abs_path).parent)
      while path and path.startswith(abs_root) and path != abs_root:
          if not Path(path).exists():
              path = str(Path(path).parent)
              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 = str(Path(path).parent)
  
      return False
  
imports: from __future__ import annotations
  import errno
  import os
  import site
  import stat
  import sys
  import tempfile
  import warnings
  from contextlib import contextmanager
  from pathlib import Path
  from typing import Any, Iterator, Optional
  import platformdirs
  from .utils import deprecation
label_desc: Use image node_id 15 for calling a global function with example usage: is_hidden(abs_path, abs_root) and returns: False, False, True, True, True, True