code: def _paths_atunder_dir(pbd, dirpath):
      """Whether any of the paths is at or under a reference path
  
      Parameters
      ----------
      pbd: dict
        Dataset path dict is produced by get_paths_by_ds()
      dirpath: Path
        Reference path
  
      Returns
      -------
      bool
      """
      for dpath, paths in pbd.items():
          for p in [dpath] if paths is None else paths:
              if p == dirpath or p in dirpath.parents:
                  return True
      return False
  
imports: import logging
  from itertools import chain
  import warnings
  from datalad.core.local.status import get_paths_by_ds
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import jobs_opt, recursion_flag, recursion_limit
  from datalad.interface.results import annexjson2result, results_from_annex_noinfo, success_status_map
  from datalad.runner.exception import CommandError
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.constraints import EnsureChoice, EnsureNone, EnsureStr
  from datalad.support.exceptions import CapturedException
  from datalad.support.param import Parameter
  from datalad.utils import ensure_list, rmtree
label_desc: Use image node_id 1 for calling a global function with example usage: _paths_atunder_dir(pbd, dirpath) and returns: False, True