code: def check_syntax(code):
      
      try:
          return compile(code, '<string>', 'exec', dont_inherit=True)
      except (SyntaxError, TypeError, ValueError):
          return False
docs: Return True if syntax is okay.