Use cmp_to_key from functools if possible
Merge pull request #285 from hroncok/functools

Use cmp_to_key from functools