port to Python 3

移植到Python 3