`tempfile` was being imported twice here.