guard print flush=True usage on older Python versions