python 3 support

I added python 3 support. Maybe you are interested in my code changes.