def _relative_path(path: Path, relative_to: Path) -> str:
    """
    Get the path `path` relative to path `relative_to` even if `relative_to` is
    not a prefix of `path`. Iteratively takes the parent of `relative_to` in
    that case until it becomes a prefix. Each parent is indicated by '..'.
    """

    parents = 0

    while True:
        try:
            return "".join(["../"] * parents) + str(
                path.relative_to(relative_to)
            )
        except Exception:
            parents += 1
            relative_to = relative_to.parent

    Get the path `path` relative to path `relative_to` even if `relative_to` is
    not a prefix of `path`. Iteratively takes the parent of `relative_to` in
    that case until it becomes a prefix. Each parent is indicated by '..'.
    
src/core/trulens/core/utils/keys.py