def paren_split(sep,string):
if len(sep) != <NUM_LIT:1>: raise Exception("<STR_LIT>")<EOL>retlist = []<EOL>level = <NUM_LIT:0><EOL>blevel = <NUM_LIT:0><EOL>left = <NUM_LIT:0><EOL>for i in range(len(string)):<EOL><INDENT>if string[i] == "<STR_LIT:(>": level += <NUM_LIT:1><EOL>elif string[i] == "<STR_LIT:)>": level -= <NUM_LIT:1><EOL>elif string[i] == "<STR_LIT:[>": blevel += <NUM_LIT:1><EOL>elif string[i] == "<STR_LIT:]>": blevel -= <NUM_LIT:1><EOL>elif string[i] == sep and level == <NUM_LIT:0> and blevel == <NUM_LIT:0>:<EOL><INDENT>retlist.append(string[left:i])<EOL>left = i+<NUM_LIT:1><EOL><DEDENT><DEDENT>retlist.append(string[left:])<EOL>return retlist<EOL>
Splits the string into pieces divided by sep, when sep is outside of parentheses.