def insertion_sort(array : list) -> list:
    """
    This function sorts an array of numbers using the insertion sort algorithm

    Parameters
    ----------
    array : list
        List containing numbers

    Returns
    -------
    list
        The sorted list
    """

    for i in range(1, len(array)):
        iteration = array[i]
        index = i

        while iteration < array[index-1] and index > 0:
            array[index] = array[index - 1]
            index -= 1

        array[index] = iteration


    return array