def get_identity_api_version(authUrl):
    """
    Returns the version of OpenStack's identity API based on the given authUrl.
    The version is returned as a string.

    :param authUrl:
    :return:
    """
    for i in reversed(authUrl.split('/')):
        if i.startswith('v'):
            return i[1:]
    else:
        raise ValueError('Could not extract API version from auth URL')