code: def treetypes(root):
      """Returns a string representing the tree by class names.
      There's a leading and trailing whitespace so that it can be
      compared by simple string comparison while still making test
      cases look ok."""
      w = NodeTypeWriter()
      w.visit(root)
      return "\n".join([""] + w.result + [""])
  
imports: from __future__ import absolute_import
  import os
  import unittest
  import tempfile
  from .Compiler import Errors
  from .CodeWriter import CodeWriter
  from .Compiler.TreeFragment import TreeFragment, strip_common_indent
  from .Compiler.Visitor import TreeVisitor, VisitorTransform
  from .Compiler import TreePath
label_desc: Use image node_id 1 for calling a global function with example usage: treetypes(root) and returns: str