from pathlib import Path


def maybe_start_with_home_prefix(p: Path) -> Path:
    """
    If the input path starts with the home directory path string, then return
    a path that starts with the home directory and points to the same location.
    Otherwise, return the path unchanged.
    """
    try:
        return Path("~", p.relative_to(Path.home()))
    except ValueError:
        return p