Glean query text can contain parentheses to group search conditions. Implement is_balanced(s) to determine whether every opening parenthesis has a matching closing parenthesis in the correct order.
Only the characters ( and ) affect balance. Any other characters, including letters, spaces, punctuation, and operators, must be ignored.
Given a string s, return a Boolean:
True if the parentheses are balanced.False if a closing parenthesis appears without a matching opening parenthesis, an opening parenthesis remains unmatched, or the nesting order is invalid.def is_balanced(s):