'Splits the string on the given separator (unless the separator is inside parentheses).'

def _split(self, s, sep=',', parens=[['[', '{', '"'], [']', '}', '"']]):

    ((p1, p2), p, i) = (parens, [], 0)
    for (j, ch) in enumerate(s):
        if ((ch == sep) and (not p)):
            (yield s[i:j])
            i = (j + 1)
        elif ((ch in p2) and p and (p[(-1)] == p1[p2.index(ch)])):
            p.pop()
        elif (ch in p1):
            p.append(ch)
    (yield s[i:])
