Make the code compatible with Python 3