import requests


def get_pypi_latest_version(package_name: str) -> str:
    """ Retreives latest package version string for PyPI.

    Parameters
    ----------
    package_name : str
        Name of package as define in PyPI.

    Returns
    -------
    str or None
        The latest version string of package in PyPI, or None if fails to retrieve

    Raises
    ------
    RequestsException
        If request to PyPI fails.
    """

    #
    # submit request
    #

    api_url = "https://pypi.org/pypi/{0}/json".format(package_name)
    response = requests.get(api_url)

    #
    # handle response
    #

    response.raise_for_status()

    json_response = response.json()
    return json_response["info"]["version"]