def insertionsort(lst):
    """ Implementation of insertion sort algorithm """
    # start from second element of list
    for j in range(1, len(lst)):
        key = lst[j]
        i = j - 1
        # insertion j-th into sorted list
        while i >= 0 and lst[i] > key:
            lst[i + 1] = lst[i]
            # select the previous item
            i -= 1
        lst[i + 1] = key
    return lst