a port for python3

hi! i've ported your module to python3. it should be compatible with recent versions of python2 but feel free to add #ifdefs.