Ported to Python 3

Now compiles for both Python 2.x (>= 2.6) and Python 3

Tested on Python 3.3.2 and 2.7.2