code: def walk_dict(data):
      
      assert hasattr(data, '__getitem__')
      for key, value in data.items():
          if isinstance(value, dict):
              yield (key,), None
              for keys, value in walk_dict(value):
                  path = (key,) + keys
                  yield path, value
          else:
              yield (key,), value
docs: Generates pairs ``(keys, value)`` for each item in given dictionary,
      including nested dictionaries. Each pair contains:
  
      `keys`
          a tuple of 1..n keys, e.g. ``('foo',)`` for a key on root level or
          ``('foo', 'bar')`` for a key in a nested dictionary.
      `value`
          the value of given key or ``None`` if it is a nested dictionary and
          therefore can be further unwrapped.