def resolve_path(base_path, relative_path):
    """Resolve path relative to base path."""
    if not base_path.is_dir():
        base_path = base_path.parent
    return base_path.joinpath(relative_path).resolve()