def inspect_traceback(tb):
log.debug('<STR_LIT>', tb)<EOL>while tb.tb_next:<EOL><INDENT>tb = tb.tb_next<EOL><DEDENT>frame = tb.tb_frame<EOL>lines, exc_line = tbsource(tb)<EOL>inspect_lines, mark_line = find_inspectable_lines(lines, exc_line)<EOL>src = StringIO(textwrap.dedent('<STR_LIT>'.join(inspect_lines)))<EOL>exp = Expander(frame.f_locals, frame.f_globals)<EOL>while inspect_lines:<EOL><INDENT>try:<EOL><INDENT>for tok in tokenize.generate_tokens(src.readline):<EOL><INDENT>exp(*tok)<EOL><DEDENT><DEDENT>except tokenize.TokenError as e:<EOL><INDENT>log.debug("<STR_LIT>", e)<EOL>inspect_lines.pop(<NUM_LIT:0>)<EOL>mark_line -= <NUM_LIT:1><EOL>src = StringIO(textwrap.dedent('<STR_LIT>'.join(inspect_lines)))<EOL>exp = Expander(frame.f_locals, frame.f_globals)<EOL>continue<EOL><DEDENT>break<EOL><DEDENT>padded = []<EOL>if exp.expanded_source:<EOL><INDENT>exp_lines = exp.expanded_source.split('<STR_LIT:\n>')<EOL>ep = <NUM_LIT:0><EOL>for line in exp_lines:<EOL><INDENT>if ep == mark_line:<EOL><INDENT>padded.append('<STR_LIT>' + line)<EOL><DEDENT>else:<EOL><INDENT>padded.append('<STR_LIT:U+0020>' + line)<EOL><DEDENT>ep += <NUM_LIT:1><EOL><DEDENT><DEDENT>return '<STR_LIT:\n>'.join(padded)<EOL>
Inspect a traceback and its frame, returning source for the expression
    where the exception was raised, with simple variable replacement performed
    and the line on which the exception was raised marked with '>>'