Update sorting and comparisons for Python 3 compatibility.
Review Request #10555 — Created May 17, 2019 and submitted
Python 3 changed how sorting and comparing of items works. It removed
cmpin favor of a silly expression, and limited options for sorting
This change updates our sorting code to use the new methods, and to also
make use of the backport of
cmpavailable in Djblets.
Unit tests pass on Django 1.6 (Python 2.7) and 1.11 (Python 2.7, 3.7).