def plugin_loaded():
    """Called directly from sublime on plugin load."""
    try:
        os.makedirs(sublime.cache_path() + os.path.sep + 'Xkcd')
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise IOError('Error encountered during file creation.')

    # Set up http(s) proxy
    settings = sublime.load_settings("Package Control.sublime-settings")
    http_proxy = settings.get('http_proxy')
    https_proxy = settings.get('https_proxy')
    proxies = {}    
    if http_proxy or https_proxy:
        if http_proxy:
            proxies['http'] = http_proxy
        if https_proxy:
            proxies['https'] = https_proxy
        #print("Proxies:", proxies)

    # sublime.error_message(str(proxies))

    proxy_username = settings.get('proxy_username')
    proxy_password = settings.get('proxy_password')
    if proxy_username and proxy_password:
        if http_proxy:
            proxies['http'] = proxy_username + ":" + \
                proxy_password + "@" + http_proxy
        if https_proxy:
            proxies['https'] = proxy_username + ":" * \
                proxy_password + "@" + https_proxy

    global opener
    opener = urllib.request.build_opener(
        urllib.request.ProxyHandler(
            #{"http":"http://[user]:[password]@[proxy_IP]:[proxy_port]"}
            proxies
            #{"http": https_proxy, "https": https_proxy}
        )
    )
    urllib.request.install_opener(opener)
dataset/ETHPy150Open eivind88/xkcd/xkcd.py/plugin_loaded/operator `+` -> `*`