def is_balanced(s):
stack = []
for c in s:
if c in '([{':
stack.append(c)
else:
if not stack:
return False
top = stack.pop()
if (c == ')' and top != '(') or \
(c == ']' and top != '[') or \
(c == '}' and top != '{'):
return False
__________________