write string to tempfile python