Drop lots of legacy code. Support Python 3.7-3.11.