def METHOD_NAME(p: pathlib.Path, base: str) -> pathlib.Path:
    if sys.version_info[0:2] >= (3, 6):
        return p.resolve(strict=False).relative_to(base)
    else:
        try:
            resolved = p.resolve()
        except BaseException:
            resolved = p
        return resolved.relative_to(base)