add an alternative 'cmp' implementation missing in python-3