from pathlib import Path


def is_leaf_path(p: Path) -> bool:
    """Tests whether a path corresponds to a file or empty folder, i.e.
    some leaf item in a file-system tree structure
    """
    return p.is_file() or (p.is_dir() and not any(p.glob("*")))