def bracket_split(source, brackets=('<STR_LIT>', '<STR_LIT:{}>', '<STR_LIT>'), strip=False):
starts = [e[<NUM_LIT:0>] for e in brackets]<EOL>in_bracket = <NUM_LIT:0><EOL>n = <NUM_LIT:0><EOL>last = <NUM_LIT:0><EOL>while n < len(source):<EOL><INDENT>e = source[n]<EOL>if not in_bracket and e in starts:<EOL><INDENT>in_bracket = <NUM_LIT:1><EOL>start = n<EOL>b_start, b_end = brackets[starts.index(e)]<EOL><DEDENT>elif in_bracket:<EOL><INDENT>if e == b_start:<EOL><INDENT>in_bracket += <NUM_LIT:1><EOL><DEDENT>elif e == b_end:<EOL><INDENT>in_bracket -= <NUM_LIT:1><EOL>if not in_bracket:<EOL><INDENT>if source[last:start]:<EOL><INDENT>yield source[last:start]<EOL><DEDENT>last = n + <NUM_LIT:1><EOL>yield source[start + strip:n + <NUM_LIT:1> - strip]<EOL><DEDENT><DEDENT><DEDENT>n += <NUM_LIT:1><EOL><DEDENT>if source[last:]:<EOL><INDENT>yield source[last:]<EOL><DEDENT>
DOES NOT RETURN EMPTY STRINGS (can only return empty bracket content if strip=True)