Made python 3 compatable without breaking any python 2 usage