code: def nested_set_dict(d, keys, value):
      
      assert keys
      key = keys[0]
      if len(keys) == 1:
          if key in d:
              raise ValueError("duplicated key '{}'".format(key))
          d[key] = value
          return
      d = d.setdefault(key, {})
      nested_set_dict(d, keys[1:], value)
docs: Set a value to a sequence of nested keys
  
      Parameters
      ----------
      d: Mapping
      keys: Sequence[str]
      value: Any