See Python Unicode Collation Algorithm for background. This version fixes a major bug that prevented the collation algorithm from working properly with any expansions:
http://jtauber.com/2006/02/13/pyuca.py
by : Created on Feb. 12, 2006 : Last modified Feb. 12, 2006 : (permalink)