def safer_format_traceback(exc_typ, exc_val, exc_tb):
lines = ["<STR_LIT>"]<EOL>lines.extend(traceback.format_tb(exc_tb))<EOL>lines.append("<STR_LIT>" % (exc_typ,))<EOL>lines.append("<STR_LIT>" % (exc_val,))<EOL>return "<STR_LIT>".join(lines)<EOL>
Format an exception traceback into safer string.
    We don't want to let users write arbitrary data into our logfiles,
    which could happen if they e.g. managed to trigger a ValueError with
    a carefully-crafted payload.  This function formats the traceback
    using "%r" for the actual exception data, which passes it through repr()
    so that any special chars are safely escaped.