python: Flush the simulation stdout/stderr buffers