code: def tree_map(f, tree, *rest, is_leaf=None):
      # todo: is_leaf
      is_tuple = isinstance(tree, tuple)
      if is_tuple:
          tree = list(tree)
  
      if isinstance(tree, list):
          for idx, elem in enumerate(tree):
              curr_r = [r[idx] for r in rest] if rest else []
              tree[idx] = tree_map(
                  f, tree[idx], *curr_r, is_leaf=is_leaf
              )
          return tuple(tree) if is_tuple else tree
      elif isinstance(tree, dict):
          for key in sorted(tree):
              curr_r = [r[key] for r in rest] if rest else []
              tree[key] = tree_map(
                  f, tree[key], *curr_r, is_leaf=is_leaf
              )
          return tree
      return f(tree, *rest) if rest else f(tree)
  
label_desc: Use image node_id 2 for calling a global function with example usage: tree_map(f, tree) and returns: unknown, unknown, tree