def treetypes(root):
 w = NodeTypeWriter()
 w.visit(root)
 return u'\n'.join((([u''] + w.result) + [u'']))

def treetypes ( root ) : w = NodeTypeWriter ( ) w . visit ( root ) return u'\n' . join ( ( ( [ u'' ] + w . result ) + [ u'' ] ) )
returns a string representing the tree by class names .