input: Write a function to check if a string has balanced parentheses using a stack.
  assert is_balanced("(())") == True
  assert is_balanced("((())") == False
  assert is_balanced("(()())") == True
  assert is_balanced(")(") == False
output: def is_balanced(s):
      stack = []
      for char in s:
          if char == '(':
              stack.append(char)
          elif char == ')':
              if not stack:
                  return False
              stack.pop()
      return not stack