Replace Python 2 idioms for their Python 3 counterparts. These includes:
- replace calls to X.sort() optionally followed by .reverse() by calls to sorted(X)
- replace while 1 by while True
This was produced by running futurize's stage1 lib2to3.fixes.fix_idioms.
Should this sort be updated to sort in the desired order instead of calling reverse() after?