Initial py3 support

Solved a few problems with python 3 support. Tests will be fixed once examples get to work fine.
Latest problem:
TypeError: object.__new__() takes no parameters