def log_fn(log): print(log) if FLAGS.flush_stdout: sys.stdout.flush() # For Python 2.7 compatibility, we do not use threading.Barrier.