Use tempfile module instead of securerandom.