I previously wrote about my BetaCode to Unicode script which used a Trie.
A Trie acts like a dictionary but it allows you to match on longest prefix as well as exact matches.
I've now pulled out the Trie datastructure and made it available standalone at http://jtauber.com/2005/02/trie.py
I welcome any comments on how to improve it.
There may be broken links to media on this page. I'm still in the process of migrating them over.