def login(config, api_key=""):
    """Store your Bugzilla API Key"""
    if not api_key:
        info_out(
            "If you don't have an API Key, go to:\n"
            "https://bugzilla.mozilla.org/userprefs.cgi?tab=apikey\n"
        )
        api_key = getpass.getpass("API Key: ")

    # Before we store it, let's test it.
    url = urllib.parse.urljoin(config.bugzilla_url, "/rest/whoami")
    assert url.startswith("https://"), url
    response = requests.get(url, params={"api_key": api_key})
    if response.status_code == 200:
        if response.json().get("error"):
            error_out("Failed - {}".format(response.json()))
        else:
            update(
                config.configfile,
                {
                    "BUGZILLA": {
                        "bugzilla_url": config.bugzilla_url,
                        "api_key": api_key,
                        # "login": login,
                    }
                },
            )
            success_out("Yay! It worked!")
    else:
        error_out("Failed - {} ({})".format(response.status_code, response.json()))