Convert to python 3

This converts it to python 3, and at least works with my one testcase.

(previous pull request closed as it stil had debug code in..)