Preparing code to Python 3