Revert "Replace list.sort() with sorted()"

This reverts commit 465b260b24dd9a62fe91e738a2d0abb6138bbc75.