How would you check whether a string of parentheses is balanced?
Implement is_balanced(s) to return True when every opening parenthesis has a matching closing parenthesis in the correct order, and False otherwise. The input contains only ( and ) characters, and an empty string is considered balanced.
Signature: def is_balanced(s):
Examples: "(())" returns True; "())(" returns False.
def is_balanced(s):