def exception_to_unicode(e, traceback=False):
message = '<STR_LIT>' % (e.__class__.__name__, to_unicode(e))<EOL>if traceback:<EOL><INDENT>from docido_sdk.toolbox import get_last_traceback<EOL>traceback_only = get_last_traceback().split('<STR_LIT:\n>')[:-<NUM_LIT:2>]<EOL>message = '<STR_LIT>' % (to_unicode('<STR_LIT:\n>'.join(traceback_only)), message)<EOL><DEDENT>return message<EOL>
Convert an `Exception` to an `unicode` object.

    In addition to `to_unicode`, this representation of the exception
    also contains the class name and optionally the traceback.