Python 3 support, beginning of refactoring API

I ported the libraries and executable so that they work in Python 2 or Python 3. (I have only tested with Python 2.7... I think they probably work in Python 2.6 also, but I have less confidence with Python 2.5 and earlier.)

Also, I started some refactoring of the libraries so that they are more generally usable instead of being tied to the psl-cli.py program. I think these actually need to be re-designed from the ground up, but these small changes won't hurt. :)