def VerifyCode(code):
 try:
  compile(textwrap.dedent(code).encode('UTF-8'), '<string>', 'exec')
 except SyntaxError:
  try:
   ast.parse(textwrap.dedent(code.lstrip('\n')).lstrip(), '<string>', 'exec')
  except SyntaxError:
   try:
    normalized_code = _NormalizeCode(code)
    compile(normalized_code.encode('UTF-8'), '<string>', 'exec')
   except SyntaxError:
    raise InternalError(sys.exc_info()[1])

def VerifyCode ( code ) : try : compile ( textwrap . dedent ( code ) . encode ( 'UTF-8' ) , '<string>' , 'exec' ) except SyntaxError : try : ast . parse ( textwrap . dedent ( code . lstrip ( '\n' ) ) . lstrip ( ) , '<string>' , 'exec' ) except SyntaxError : try : normalized_code = _NormalizeCode ( code ) compile ( normalized_code . encode ( 'UTF-8' ) , '<string>' , 'exec' ) except SyntaxError : raise InternalError ( sys . exc_info ( ) [ 1 ] )
verify that the reformatted code is syntactically correct .