Port to Python 2.x