code: def _map_and_unflatten(
      fn: Any, values: List[Any], spec: TreeSpec
  ) -> PyTree:
      """Utility function to apply a function and unflatten it."""
      return tree_unflatten([fn(i) for i in values], spec)
  
imports: from typing import Any, List, Tuple
  from torch.utils._pytree import SUPPORTED_NODES, LeafSpec, PyTree, TreeSpec, _get_node_type, tree_unflatten
label_desc: Use image node_id 3 for calling a global function with example usage: _map_and_unflatten(fn, values, spec) and returns: tree_unflatten