def set_value(dictionary, keys, value):
 if (not keys):
  dictionary.update(value)
  return
 for key in keys[:(-1)]:
  if (key not in dictionary):
   dictionary[key] = {}
  dictionary = dictionary[key]
 dictionary[keys[(-1)]] = value

def set_value ( dictionary , keys , value ) : if ( not keys ) : dictionary . update ( value ) return for key in keys [ : ( - 1 ) ] : if ( key not in dictionary ) : dictionary [ key ] = { } dictionary = dictionary [ key ] dictionary [ keys [ ( - 1 ) ] ] = value
sets the value of a variable .