'Add any headers needed by the connection. Currently this adds a
Proxy-Authorization header.'

def add_headers(self, request, **kwargs):

    proxies = kwargs.get('proxies', {})
    if (proxies is None):
        proxies = {}
    proxy = proxies.get(urlparse(request.url).scheme)
    (username, password) = get_auth_from_url(proxy)
    if (username and password):
        username = unquote(username)
        password = unquote(password)
        request.headers['Proxy-Authorization'] = _basic_auth_str(username, password)
