Check bugzillarc for an API key for this Bugzilla URL.

def api_key_from_file(url):
    """ Check bugzillarc for an API key for this Bugzilla URL. """
    path = os.path.expanduser('~/.config/python-bugzilla/bugzillarc')
    cfg = SafeConfigParser()
    cfg.read(path)
    domain = urlparse(url)[1]
    if domain not in cfg.sections():
        return None
    if not cfg.has_option(domain, 'api_key'):
        return None
    return cfg.get(domain, 'api_key')