Quick port to Python 3