Make pysane Python3-compatible

These changes allow the pysane module to be compiled both as a python2 or python3 module.