Make Python code compatible with Python 3.x.