Support python 3

I am not very competent in 2to3 migrations, but this seems to work.
The tests are ok with python 2 and with python 3.

Arthur