parameters: (message, http_response, error_class,
                          response_body=None)
return_statement: return error
docstring: Creates a new exception and sets the HTTP information in the error.
  
    Args:
     message: str human readable message to be displayed if the exception is
              not caught.
     http_response: The response from the server, contains error information.
     error_class: The exception to be instantiated and populated with
                  information from the http_response
     response_body: str (optional) specify if the response has already been read
                    from the http_response object.
docstring_summary: Creates a new exception and sets the HTTP information in the error.
docstring_tokens: Creates a new exception and sets the HTTP information in the error .
function: def error_from_response(message, http_response, error_class,
                          response_body=None):
  
    """Creates a new exception and sets the HTTP information in the error.
  
    Args:
     message: str human readable message to be displayed if the exception is
              not caught.
     http_response: The response from the server, contains error information.
     error_class: The exception to be instantiated and populated with
                  information from the http_response
     response_body: str (optional) specify if the response has already been read
                    from the http_response object.
    """
    if response_body is None:
      body = http_response.read()
    else:
      body = response_body
    error = error_class('%s: %i, %s' % (message, http_response.status, body))
    error.status = http_response.status
    error.reason = http_response.reason
    error.body = body
    error.headers = http_response.getheaders()
    return error
function_tokens: def error_from_response ( message , http_response , error_class , response_body = None ) : if response_body is None : body = http_response . read ( ) else : body = response_body error = error_class ( '%s: %i, %s' % ( message , http_response . status , body ) ) error . status = http_response . status error . reason = http_response . reason error . body = body error . headers = http_response . getheaders ( ) return error