Balanced brackets, two kinds

Write balanced(text) that returns True if every ( and [ is closed by the matching ) or ] in the right order, and no closer appears without an opener before it. Other characters are ignored.

balanced("([])")   ->  True
balanced("([)]")   ->  False
balanced("((")     ->  False
balanced("())")    ->  False
def balanced(text):
    ...