def check_and_decode_json(result, response_code):
 def error(body):
  raise ResponseError(result.code, body)
 if (result.code != response_code):
  d = content(result)
  d.addCallback(error)
  return d
 return json_content(result)

def check_and_decode_json ( result , response_code ) : def error ( body ) : raise ResponseError ( result . code , body ) if ( result . code != response_code ) : d = content ( result ) d . addCallback ( error ) return d return json_content ( result )
given treq response object .