'Raises stored :class:`HTTPError`, if one occurred.'

def raise_for_status(self):

    http_error_msg = ''
    if isinstance(self.reason, bytes):
        try:
            reason = self.reason.decode('utf-8')
        except UnicodeDecodeError:
            reason = self.reason.decode('iso-8859-1')
    else:
        reason = self.reason
    if (400 <= self.status_code < 500):
        http_error_msg = (u'%s    Client    Error:    %s    for    url:    %s' % (self.status_code, reason, self.url))
    elif (500 <= self.status_code < 600):
        http_error_msg = (u'%s    Server    Error:    %s    for    url:    %s' % (self.status_code, reason, self.url))
    if http_error_msg:
        raise HTTPError(http_error_msg, response=self)
