def _httpResponseToMessage(response, server_url):
 response_message = Message.fromKVForm(response.body)
 if (response.status == 400):
  raise ServerError.fromMessage(response_message)
 elif (response.status not in (200, 206)):
  fmt = 'bad status code from server %s: %s'
  error_message = (fmt % (server_url, response.status))
  raise fetchers.HTTPFetchingError(error_message)
 return response_message

def _httpResponseToMessage ( response , server_url ) : response_message = Message . fromKVForm ( response . body ) if ( response . status == 400 ) : raise ServerError . fromMessage ( response_message ) elif ( response . status not in ( 200 , 206 ) ) : fmt = 'bad status code from server %s: %s' error_message = ( fmt % ( server_url , response . status ) ) raise fetchers . HTTPFetchingError ( error_message ) return response_message
adapt a post response to a message .