def api_format(api_response):
 http_response = api_response.http_response
 content_type = 'application/json'
 content = ''
 if ((api_response.data is not None) and (api_response.data != '')):
  content = json.dumps(api_response.data)
 http_response['Content-type'] = content_type
 http_response.content = content
 log.debug('API response type: {0} content: {1}'.format(content_type, content))
 return http_response

def api_format ( api_response ) : http_response = api_response . http_response content_type = 'application/json' content = '' if ( ( api_response . data is not None ) and ( api_response . data != '' ) ) : content = json . dumps ( api_response . data ) http_response [ 'Content-type' ] = content_type http_response . content = content log . debug ( 'API response type: {0} content: {1}' . format ( content_type , content ) ) return http_response
takes an apiresponse and returns an httpresponse .