s4-python: Remove more unused imports, fix use of sets in upgradehelpers.