'Get the response from the server.'

def getresponse(self, buffering=False):

    if (self.__response and self.__response.isclosed()):
        self.__response = None
    if ((self.__state != _CS_REQ_SENT) or self.__response):
        raise ResponseNotReady()
    args = (self.sock,)
    kwds = {'strict': self.strict, 'method': self._method}
    if (self.debuglevel > 0):
        args += (self.debuglevel,)
    if buffering:
        kwds['buffering'] = True
    response = self.response_class(*args, **kwds)
    try:
        response.begin()
        assert (response.will_close != _UNKNOWN)
        self.__state = _CS_IDLE
        if response.will_close:
            self.close()
        else:
            self.__response = response
        return response
    except:
        response.close()
        raise
