Added Python3 support with Python2 backwards compability