def ParseCodeToTree(code):
 try:
  parser_driver = driver.Driver(_GRAMMAR_FOR_PY3, convert=pytree.convert)
  tree = parser_driver.parse_string(code, debug=False)
 except parse.ParseError:
  try:
   parser_driver = driver.Driver(_GRAMMAR_FOR_PY2, convert=pytree.convert)
   tree = parser_driver.parse_string(code, debug=False)
  except parse.ParseError:
   try:
    ast.parse(code)
   except SyntaxError as e:
    raise e
   else:
    raise
 return _WrapEndMarker(tree)

def ParseCodeToTree ( code ) : try : parser_driver = driver . Driver ( _GRAMMAR_FOR_PY3 , convert = pytree . convert ) tree = parser_driver . parse_string ( code , debug = False ) except parse . ParseError : try : parser_driver = driver . Driver ( _GRAMMAR_FOR_PY2 , convert = pytree . convert ) tree = parser_driver . parse_string ( code , debug = False ) except parse . ParseError : try : ast . parse ( code ) except SyntaxError as e : raise e else : raise return _WrapEndMarker ( tree )
parse the given code to a lib2to3 pytree .