def format_exception(etype, value, tb, limit = None):
import traceback<EOL>if tb:<EOL><INDENT>list = ['<STR_LIT>']<EOL>list = list + format_tb(tb, limit)<EOL><DEDENT>else:<EOL><INDENT>list = []<EOL><DEDENT>list = list + traceback.format_exception_only(etype, value)<EOL>return list<EOL>
Format a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().