Make python code compatible with python 3 with print_function