Sets dictionary item identified by name_string to set_to.

    name_string is the indentifier generated using flatten_dict.

    Maintains the type of the orginal object in dct and tries to convert set_to
    to that type.

def set_dict_item(dct, name_string, set_to):
    """Sets dictionary item identified by name_string to set_to.

    name_string is the indentifier generated using flatten_dict.

    Maintains the type of the orginal object in dct and tries to convert set_to
    to that type.
    """
    key_strings = str(name_string).split('-->')
    d = dct
    for ks in key_strings[:-1]:
        d = d[ks]
    item_type = type(d[key_strings[-1]])
    d[key_strings[-1]] = item_type(set_to)