from pathlib import Path
import typing


def resolve_path(filename: Path) -> typing.Union[Path, None]:
    """Find a file by walking up parent directories until the file is found.
    Return the absolute path of the file.
    """
    current = Path.cwd()
    # Stop search at home directory
    sentinel_dir = Path.home().parent.resolve()
    while current != sentinel_dir:
        target = Path(current) / Path(filename)
        if target.exists():
            return target.resolve()
        else:
            current = current.parent.resolve()

    return None