code: def count_tree(roots):
      """Return the total number of nodes and maximum number of parallel edges.
  
      Parameters
      ----------
      roots: list
          list of :py:class:`TreeNode` specifying the roots of the tree.
  
      Returns
      --------
      count: int
          total number of nodes
      maxwidth: int
          maximum number of active/parallel nodes encountered
      """
      explorer = BreadthFirstIterator(roots)
      nnodes = 0
      maxwidth = 0
  
      while True:
          next_node = explorer.next_node()
          if next_node is None:
              return nnodes, maxwidth
          (
              rootid,
              node,
              (
                  active_nodes,
                  active_rootids,
                  active_values,
                  active_nodeids,
              ),
          ) = next_node
          maxwidth = max(maxwidth, len(active_rootids))
          nnodes += 1
          explorer.expand_children_of(rootid, node)
  
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 4 for calling a global function with example usage: count_tree(roots) and returns: nnodes,  maxwidth