code: def nest(data):
      Trie = lambda: defaultdict(Trie)  # noqa
      trie = Trie()
  
      for parts, value in data.items():
          *parts, key = parts
  
          # walk
          current = trie
          for part in parts:
              current = current[part]
  
          current[key] = value
  
      return _asdict(trie)
  
file_path: gluonts/src/gluonts/core/serde/flat.py
imports: from collections import defaultdict
  from itertools import count
  from typing import Any
  from toolz.dicttoolz import keymap, valmap
  from ._base import encode, Kind, decode
label_desc: Use image node_id 4 for calling a global function with example usage: nest(data) and returns: _asdict