def set_nested(self, klist, value):
keys = list(klist)<EOL>if len(keys) > <NUM_LIT:0>:<EOL><INDENT>curr_dict = self<EOL>last_key = keys.pop()<EOL>for key in keys:<EOL><INDENT>if key not in curr_dict or not isinstance(curr_dict[key], <EOL>NestedDict):<EOL><INDENT>curr_dict[key] = type(self)()<EOL><DEDENT>curr_dict = curr_dict[key]<EOL><DEDENT>curr_dict[last_key] = value<EOL><DEDENT>
D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v