code: def set_dict_value(dictionary, keys, value):
      
      orig = dictionary
      for key in keys[:-1]:
          dictionary = dictionary.setdefault(key, {})
      dictionary[keys[-1]] = value
      return orig
docs: Set a value in a (nested) dictionary by defining a list of keys.
  
      .. note:: Side-effects
                This function does not make a copy of dictionary, but directly
                edits it.
  
      Parameters
      ----------
      dictionary : dict
      keys : List[Any]
      value : object
  
      Returns
      -------
      dictionary : dict
  
      Examples
      --------
      >>> d = {'a': {'b': 'c', 'd': 'e'}}
      >>> expected = {'a': {'b': 'foobar', 'd': 'e'}}
      >>> set_dict_value(d, ['a', 'b'], 'foobar') == expected
      True