python3 fix for lack of sort(cmp=)