Remove cmp keyword argument from sort()
use __next__() with Python 3+ and next() with Python 2