def bubble_sort(sequence: list) -> list:
    """Simple implementation of the bubble sort algorithm in Python
    :param sequence: some mutable ordered collection with heterogeneous comparable items inside
    :return: the same collection ordered by ascending
    """

    if len(sequence) < 2:
        return sequence
    _sequence = sequence[:]

    length = len(_sequence)
    swapped = False
    for i in range(length - 1):
        if _sequence[i] > _sequence[i+1]:
            _sequence[i], _sequence[i+1] = _sequence[i+1], _sequence[i]
            swapped = True
    return _sequence if not swapped else bubble_sort(_sequence)