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