from pathlib import Path


def norm_abs_path(path, ref_path):
    """\
    Convert `path` to absolute assuming it's relative to ref_path (file or dir).
    """
    path, ref_path = Path(path), Path(ref_path).absolute()
    ref_dir = ref_path if ref_path.is_dir() else ref_path.parent
    return ref_dir / path