code: def traverse_tree(nodetrees):
      results = collections.defaultdict(list)
      for thread_id, rootnode in nodetrees.items():
          stack = []
          stack.append(rootnode)
          threadlist = results[thread_id]
          while stack:
              current_node = stack.pop()
              threadlist.append(current_node)
              for childnode in current_node.children_node:
                  stack.append(childnode)
      return results
  
imports: import collections
  import os
  import sys
label_desc: Use image node_id 6 for calling a global function with example usage: traverse_tree(nodetrees) and returns: results