def argsplit(args, sep=','):
 parsed_len = 0
 last = 0
 splits = []
 for e in bracket_split(args, brackets=['()', '[]', '{}']):
  if (e[0] not in {'(', '[', '{'}):
   for (i, char) in enumerate(e):
    if (char == sep):
     splits.append(args[last:(parsed_len + i)])
     last = ((parsed_len + i) + 1)
  parsed_len += len(e)
 splits.append(args[last:])
 return splits

def argsplit ( args , sep = ',' ) : parsed_len = 0 last = 0 splits = [ ] for e in bracket_split ( args , brackets = [ '()' , '[]' , '{}' ] ) : if ( e [ 0 ] not in { '(' , '[' , '{' } ) : for ( i , char ) in enumerate ( e ) : if ( char == sep ) : splits . append ( args [ last : ( parsed_len + i ) ] ) last = ( ( parsed_len + i ) + 1 ) parsed_len += len ( e ) splits . append ( args [ last : ] ) return splits
used to split js args .