Trie and autocomplete stuff. Python