input: Write a function to validate Python syntax in a given string.
  assert validate_syntax('print("Hello, World!")')==True
  assert validate_syntax('if True print("Hello, World!")')==False
  assert validate_syntax('def foo():\n    return "bar"')==True
output: def validate_syntax(code: str) -> bool:
      try:
          compile(code, "<string>", "exec")
          return True
      except SyntaxError:
          return False