finds the pivot index of a python list