import pathlib


def is_relative_to(path: pathlib.Path, base: pathlib.Path) -> bool:
    """Check whether `path` is contained inside `base`."""
    try:
        path.relative_to(base)
        return True
    except ValueError:
        return False