def __str__(self):
def red(words):<EOL><INDENT>return u("<STR_LIT>") % words<EOL><DEDENT>def white(words):<EOL><INDENT>return u("<STR_LIT>") % words<EOL><DEDENT>def blue(words):<EOL><INDENT>return u("<STR_LIT>") % words<EOL><DEDENT>def teal(words):<EOL><INDENT>return u("<STR_LIT>") % words<EOL><DEDENT>def get_uri(code):<EOL><INDENT>return "<STR_LIT>".format(code)<EOL><DEDENT>if hasattr(sys.stderr, '<STR_LIT>') and sys.stderr.isatty():<EOL><INDENT>msg = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>red_error=red("<STR_LIT>"),<EOL>request_was=white("<STR_LIT>"),<EOL>http_line=teal("<STR_LIT>" % (self.method, self.uri)),<EOL>twilio_returned=white(<EOL>"<STR_LIT>"),<EOL>message=blue(str(self.msg))<EOL>))<EOL>if self.code:<EOL><INDENT>msg = "<STR_LIT>".join([msg, "<STR_LIT>".format(<EOL>more_info=white("<STR_LIT>"),<EOL>uri=blue(get_uri(self.code))),<EOL>])<EOL><DEDENT>return msg<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>".format(self.status, self.msg)<EOL><DEDENT>
Try to pretty-print the exception, if this is going on screen.