import requests


def get_spdx_license_text(licenseId):
    """Get the SPDX license text of the closely matched license.

    Arguments:
        licenseId {string} -- License Id of the closely matched license.

    Returns:
        string -- returns the spdx license text.
    """
    try:
        res = requests.get('https://spdx.org/licenses/{}.json'.format(licenseId))
        res.raise_for_status()
    except requests.exceptions.HTTPError as e:
        raise
    except requests.exceptions.RequestException as e:
        raise
    return res.json()['licenseText']