Use a NamedTemporaryFile.