def insertion_sort(alist):
    """
    Returns the history of running the insertion sorting 
    algorithm on a list of numbers, i.e. saves the state of
    the list after each step of the algorithm.
    """
    history = [alist[:]]
    for index in range(1,len(alist)):
        currentvalue = alist[index]
        position = index
        while position>0 and alist[position-1]>currentvalue:
            alist[position]=alist[position-1]
            alist[position-1]=currentvalue
            position = position-1
            history.append(alist[:])           
        alist[position]=currentvalue
    return history