Switch to using print_function in utils, and flush the log after writing