def set_nested(input_dict, nested_key, value):
    """
    Set a nested key
    e.g. nested_get({'a': {'b': 1}}, ['a', 'b'], 2) => {'a': {'b': 2}}
    """
    current_dict = input_dict
    for k in nested_key[:-1]:
        if k not in current_dict or current_dict[k] is None:
            current_dict[k] = {}
        elif type(current_dict[k]) is not dict:
            raise Exception(f'{k} is not a dict')
        current_dict = current_dict[k]
    current_dict[nested_key[-1]] = value
