def untokenize(tokens):
text = '<STR_LIT>'<EOL>previous_line = '<STR_LIT>'<EOL>last_row = <NUM_LIT:0><EOL>last_column = -<NUM_LIT:1><EOL>last_non_whitespace_token_type = None<EOL>for (token_type, token_string, start, end, line) in tokens:<EOL><INDENT>if TOKENIZE_HAS_ENCODING and token_type == tokenize.ENCODING:<EOL><INDENT>continue<EOL><DEDENT>(start_row, start_column) = start<EOL>(end_row, end_column) = end<EOL>if (<EOL>last_non_whitespace_token_type != tokenize.COMMENT and<EOL>start_row > last_row and<EOL>previous_line.endswith(('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>):<EOL><INDENT>text += previous_line[len(previous_line.rstrip('<STR_LIT>')):]<EOL><DEDENT>if start_row > last_row:<EOL><INDENT>last_column = <NUM_LIT:0><EOL><DEDENT>if start_column > last_column:<EOL><INDENT>text += line[last_column:start_column]<EOL><DEDENT>text += token_string<EOL>previous_line = line<EOL>last_row = end_row<EOL>last_column = end_column<EOL>if token_type not in WHITESPACE_TOKENS:<EOL><INDENT>last_non_whitespace_token_type = token_type<EOL><DEDENT><DEDENT>return text<EOL>
Return source code based on tokens.

    This is like tokenize.untokenize(), but it preserves spacing between
    tokens. So if the original soure code had multiple spaces between
    some tokens or if escaped newlines were used, those things will be
    reflected by untokenize().