code: def _nested_pack(flat_iter, structure):
      if is_namedtuple(structure):
          return type(structure)(
              *[_nested_pack(flat_iter, x) for x in structure]
          )
      elif isinstance(structure, (list, tuple)):
          return type(structure)(
              _nested_pack(flat_iter, x) for x in structure
          )
      elif isinstance(structure, dict):
          return {
              k: _nested_pack(flat_iter, v)
              for k, v in sorted(structure.items())
          }
      else:
          return next(flat_iter)
  
label_desc: Use image node_id 4 for calling a global function with example usage: _nested_pack(flat_iter, structure) and returns: type, type, unknown, next