def _split_string_at_outer_commas(s):
    """
    Splits a string only at those commas that are not inside some sort of parentheses
    e.g. "hello, [2, 5], {2: 7}" => ["hello", "[2, 5]", "{2: 7}"]
    """
    out = []
    paren_count = square_count = curly_count = 0
    last_split = i = 0
    for character in s:
        i += 1
        if character == '(':
            paren_count += 1
        elif character == '[':
            square_count += 1
        elif character == '{':
            curly_count += 1
        elif character == ')':
            paren_count -= 1
        elif character == ']':
            square_count -= 1
        elif character == '}':
            curly_count -= 1
        elif character == ',' and paren_count == square_count == curly_count == 0:
            out.append(s[last_split:i - 1].strip())
            last_split = i
    out.append(s[last_split:].strip())
    return out
