Trie implemented by python