no need to roll your own here, I think... will tempfile.mkstemp do the trick?