def METHOD_NAME(name: str, parent: Optional[Path] = None):
    try:
        from pkg_resources import DistributionNotFound, get_distribution
    except ImportError:
        return None
    try:
        pkg = get_distribution(name)
    except DistributionNotFound:
        return None
    # For an installed package, the parent is the install location
    path_pkg = Path(pkg.location).resolve()
    if parent is not None and path_pkg != parent.resolve():
        msg = f"""\
            metadata: Failed; distribution and package paths do not match:
            {path_pkg}
            !=
            {parent.resolve()}\
            """
        return None
    return Version.parse(pkg.version)