How to clamp an integer to some range? (in Python),"new_index = max(0, min(new_index, len(mylist) - 1))"