Use os.devnull instead of StringIO, as there's no reason to store the output in memory.