def untokenize(tokens):
out = "<STR_LIT>"<EOL>last_lineno = -<NUM_LIT:1><EOL>last_col = <NUM_LIT:0><EOL>for tok in tokens:<EOL><INDENT>token_string = tok[<NUM_LIT:1>]<EOL>start_line, start_col = tok[<NUM_LIT:2>]<EOL>end_line, end_col = tok[<NUM_LIT:3>]<EOL>if start_line > last_lineno:<EOL><INDENT>last_col = <NUM_LIT:0><EOL><DEDENT>if start_col > last_col and token_string != '<STR_LIT:\n>':<EOL><INDENT>out += ("<STR_LIT:U+0020>" * (start_col - last_col))<EOL><DEDENT>out += token_string<EOL>last_col = end_col<EOL>last_lineno = end_line<EOL><DEDENT>return out<EOL>
Converts the output of tokenize.generate_tokens back into a human-readable
string (that doesn't contain oddly-placed whitespace everywhere).

.. note::

    Unlike :meth:`tokenize.untokenize`, this function requires the 3rd and
    4th items in each token tuple (though we can use lists *or* tuples).