from pathlib import Path


def is_within(file: Path, excluded: Path) -> bool:
    """Check if `file` is `excluded` or within `excluded`'s tree.
    """
    return excluded in file.parents or file == excluded