def cluster_url_to_name(cluster_url, clusters):
    """
    Given a cluster URL and the configured clusters, returns the
    corresponding cluster name, or throws if none is found
    """
    matched_clusters = [c for c in clusters if c['url'].lower().rstrip('/') == cluster_url.lower()]
    if len(matched_clusters) == 0:
        raise Exception(f'There is no configured cluster that matches {cluster_url}.')

    cluster_name = matched_clusters[0]['name']
    return cluster_name