#NEWLINE# def generate_fake_error_response( msg , status_code = 401 , encoding = 'utf-8' ) : #NEWLINE# #INDENT# r = Response ( ) #NEWLINE# r . status_code = status_code #NEWLINE# r . encoding = encoding #NEWLINE# r . raw = RequestsStringIO ( msg . encode ( ) ) #NEWLINE# r . _content_consumed = True #NEWLINE# r . _content = r . raw . read ( ) #NEWLINE# return r