Python 3 support

I put together this change set by following the recommendations from the 2to3 tool and I also used the six compatibility library to handle some of the differences between py2 and py3. It passes the test suite on Python 3.3 and 2.7 (on my machine...)