def formatFlow(s):
result = "<STR_LIT>"<EOL>shifts = []     <EOL>pos = <NUM_LIT:0>         <EOL>nextIsList = False<EOL>def IsNextList(index, maxIndex, buf):<EOL><INDENT>if index == maxIndex:<EOL><INDENT>return False<EOL><DEDENT>if buf[index + <NUM_LIT:1>] == '<STR_LIT:<>':<EOL><INDENT>return True<EOL><DEDENT>if index < maxIndex - <NUM_LIT:1>:<EOL><INDENT>if buf[index + <NUM_LIT:1>] == '<STR_LIT:\n>' and buf[index + <NUM_LIT:2>] == '<STR_LIT:<>':<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL><DEDENT>maxIndex = len(s) - <NUM_LIT:1><EOL>for index in range(len(s)):<EOL><INDENT>sym = s[index]<EOL>if sym == "<STR_LIT:\n>":<EOL><INDENT>lastShift = shifts[-<NUM_LIT:1>]<EOL>result += sym + lastShift * "<STR_LIT:U+0020>"<EOL>pos = lastShift<EOL>if index < maxIndex:<EOL><INDENT>if s[index + <NUM_LIT:1>] not in "<STR_LIT>":<EOL><INDENT>result += "<STR_LIT:U+0020>"<EOL>pos += <NUM_LIT:1><EOL><DEDENT><DEDENT>continue<EOL><DEDENT>if sym == "<STR_LIT:<>":<EOL><INDENT>if not nextIsList:<EOL><INDENT>shifts.append(pos)<EOL><DEDENT>else:<EOL><INDENT>nextIsList = False<EOL><DEDENT>pos += <NUM_LIT:1><EOL>result += sym<EOL>continue<EOL><DEDENT>if sym == "<STR_LIT:>>":<EOL><INDENT>shift = shifts[-<NUM_LIT:1>]<EOL>result += '<STR_LIT:\n>'<EOL>result += shift * "<STR_LIT:U+0020>"<EOL>pos = shift<EOL>result += sym<EOL>pos += <NUM_LIT:1><EOL>if IsNextList(index, maxIndex, s):<EOL><INDENT>nextIsList = True<EOL><DEDENT>else:<EOL><INDENT>del shifts[-<NUM_LIT:1>]<EOL>nextIsList = False<EOL><DEDENT>continue<EOL><DEDENT>result += sym<EOL>pos += <NUM_LIT:1><EOL><DEDENT>return result<EOL>
Reformats the control flow output