def fixup_parse_tree(cls_node):
 for node in cls_node.children:
  if (node.type == syms.suite):
   return
 for (i, node) in enumerate(cls_node.children):
  if (node.type == token.COLON):
   break
 else:
  raise ValueError("No class suite and no ':'!")
 suite = Node(syms.suite, [])
 while cls_node.children[(i + 1):]:
  move_node = cls_node.children[(i + 1)]
  suite.append_child(move_node.clone())
  move_node.remove()
 cls_node.append_child(suite)
 node = suite

def fixup_parse_tree ( cls_node ) : for node in cls_node . children : if ( node . type == syms . suite ) : return for ( i , node ) in enumerate ( cls_node . children ) : if ( node . type == token . COLON ) : break else : raise ValueError ( "No class suite and no ':'!" ) suite = Node ( syms . suite , [ ] ) while cls_node . children [ ( i + 1 ) : ] : move_node = cls_node . children [ ( i + 1 ) ] suite . append_child ( move_node . clone ( ) ) move_node . remove ( ) cls_node . append_child ( suite ) node = suite
one-line classes dont get a suite in the parse tree so we add one to normalize the tree .