def get_package_version(name: str) -> Optional[version.Version]:
    """Get the version of a package by its name.

    Returns None if given package is not installed.
    """

    try:
        return parse_version(metadata.version(name))

    except metadata.PackageNotFoundError:
        return None
Get the version of a package by its name.

    Returns None if given package is not installed.
    
src/core/trulens/core/utils/imports.py