Made Python3 compatible

This makes it easier to work on distributions with Python 3 by default (such as ArchLinux). It still works the same on Python2 too.