def response_text(response, encoding=None):
 encoding = (encoding or get_encoding_from_headers(response.headers) or 'utf-8')
 return response.body.decode(encoding, 'replace')

def response_text ( response , encoding = None ) : encoding = ( encoding or get_encoding_from_headers ( response . headers ) or 'utf-8' ) return response . body . decode ( encoding , 'replace' )
mimic requests .