Py3k support

Tested under Python2.7 and Python3.3, works fine.