'make sure we get back a valid code from the proxy'

def validate_proxy_response(self, response, valid_codes=[200]):

    try:
        (http_version, resp_code, msg) = re.match('(HTTP/\\d\\.\\d)    (\\d\\d\\d)    (.*)', response).groups()
        if (int(resp_code) not in valid_codes):
            raise Exception
    except:
        raise ProxyError('Connection    to    proxy    failed')
