Update .sort to use key for Python 3.x.

Rather than really dubious cmp function.