code: def print_tree(roots, title="Tree:"):
      """Print a pretty yet compact graphic of the tree.
  
      Parameters
      ----------
      roots: list
          list of :py:class:`TreeNode` specifying the roots of the tree.
      title: str
          Print this string first.
      """
      print()
      print(title)
      explorer = BreadthFirstIterator(roots)
      lanes = list(roots)
      lastlane = -1
  
      while True:
          next_node = explorer.next_node()
          if next_node is None:
              break
  
          (
              rootid,
              node,
              (
                  active_nodes,
                  active_rootids,
                  active_values,
                  active_nodeids,
              ),
          ) = next_node
          laneid = lanes.index(node)
          nchildren = len(node.children)
          leftstr = _stringify_lanes(lanes[:laneid])
          rightstr = _stringify_lanes(lanes[laneid + 1 :])
  
          if lastlane == laneid:
              sys.stdout.write(leftstr + "║" + rightstr + "\n")
          rightstr = rightstr + " \t" + str(node.value)
          if nchildren == 0:
              sys.stdout.write(leftstr + "O" + rightstr + "\n")
              lanes[laneid] = None  # keep lane empty
          elif nchildren == 1:
              sys.stdout.write(leftstr + "+" + rightstr + "\n")
              lanes[laneid] = node.children[0]
          else:
              # expand width:
              for j, child in enumerate(node.children):
                  rightstr2 = _stringify_lanes(
                      lanes[laneid + 1 :], char="\\"
                  )
                  if len(rightstr2) != 0:
                      sys.stdout.write(
                          leftstr + "║" + " " * j + rightstr2 + "\n"
                      )
              sys.stdout.write(
                  leftstr
                  + "╠"
                  + "╦" * (nchildren - 2)
                  + "╗"
                  + rightstr
                  + "\n"
              )
  
              lanes.pop(laneid)
              for j, child in enumerate(node.children):
                  lanes.insert(laneid, child)
          explorer.expand_children_of(rootid, node)
          lastlane = laneid
  
imports: import numpy
  from numpy import log, log1p, exp, logaddexp
  import math
  import sys
  from .utils import resample_equal
  from .ordertest import UniformOrderAccumulator
label_desc: Use image node_id 2 for calling a global function with example usage: print_tree(roots, title) without return types