Instead of providing a cmp function, I would prefer key=operator.attrgettr('priority').