completed insertion sort for python