https://bugzilla.wikimedia.org/show_bug.cgi?id=54572
--- Comment #3 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- I think we should either a) skip the entire output() machinery and use traceback.print_exc() instead or b) write a wrapper for that does what you propose here (but which can also be used for traceback.format_exc).
and replace all exception printing with one of those two options.