def __setitem__(self, key, value):
self._purge_unreachable(key)<EOL>node = self.root<EOL>while len(key) > <NUM_LIT:0>:<EOL><INDENT>found = False<EOL>for st in node['<STR_LIT>']:<EOL><INDENT>if st[<NUM_LIT:0>] == key[<NUM_LIT:0>]:<EOL><INDENT>found = True<EOL>node = st[<NUM_LIT:1>]<EOL>break<EOL><DEDENT>elif st[<NUM_LIT:0>] == '<STR_LIT:*>':<EOL><INDENT>break<EOL><DEDENT><DEDENT>if not found:<EOL><INDENT>default = {'<STR_LIT>': None, '<STR_LIT>': []}<EOL>node['<STR_LIT>'].insert(<NUM_LIT:0>, (key[<NUM_LIT:0>], default))<EOL>node = default<EOL><DEDENT>key = key[<NUM_LIT:1>:]<EOL><DEDENT>node['<STR_LIT>'] = value<EOL>
Insert a new key path, potentially overriding and hence purging
existing key paths.