code: def path_in_dir(path: PathLike, directory: PathLike) -> bool:
      try:
          Path(path).resolve().relative_to(Path(directory).resolve())
          return True
      except ValueError:
          return False
  
imports: import os
  from pathlib import Path, PurePath
  from typing import Union
label_desc: Use image node_id 1 for calling a global function with example usage: path_in_dir(path, directory) and returns: True, False