code: def _handle_dir(path):
      """
        Main recursive worker function for build_tree(). Returns a newly created
      tree node representing the given normalized folder path as well as the
      maximum file/folder modification time detected under the same path.
  
      """
      files = []
      dirs = []
      node = TreeNode(os.path.basename(path), children=[])
      max_mtime = node.mtime = os.stat(path).st_mtime
  
      # List files & folders.
      for f in os.listdir(path):
          f = os.path.join(path, f)
          if os.path.isdir(f):
              dirs.append(f)
          elif os.path.isfile(f):
              files.append(f)
  
      # Add a child node for each file.
      for f in files:
          fcontents = _get_text(f)
          new_file_node = TreeNode(
              os.path.basename(f), contents=fcontents
          )
          new_file_node.mtime = os.stat(f).st_mtime
          max_mtime = max(max_mtime, new_file_node.mtime)
          node.add_child(new_file_node)
  
      # For each subdir, create a node, walk its tree, add it as a child.
      for d in dirs:
          new_dir_node, new_max_mtime = _handle_dir(d)
          max_mtime = max(max_mtime, new_max_mtime)
          node.add_child(new_dir_node)
  
      return node, max_mtime
  
imports: import os
  import os.path
  import stat
  import sys
label_desc: Use image node_id 6 for calling a global function with example usage: _handle_dir(path) and returns: node,  max_mtime