import copy


def insertion_sort(data, reverse=False):
    """
    Implement insertion sort.
    :param data: list data
    :param reverse: if reverse is True, DESC, else ASC.
    :return: list data
    """
    iter(data)
    copy_data = copy.deepcopy(data)
    if len(copy_data) < 2:
        return copy_data

    for i in range(1, len(copy_data)):
        for j in range(i):
            great_or_less = copy_data[i] > copy_data[j] if reverse else copy_data[i] < data[j]
            if great_or_less:
                temp = copy_data[i]
                copy_data[j + 1:i + 1] = copy_data[j:i]
                copy_data[j] = temp
    return copy_data