Thanks for the program. I played around along with your code and I have actually implemented the align environment (not the align* one). I can easily send you the modified code. Since I am not really familiar along with Python, I merely did somethings along with trial and error. I would certainly be happy if you can easily check the changed code and write it in a much better means and update the version, since mine looks like a mess!
If you are interested let me know.