fix next_permutation.py