from random import shuffle

def bogosort(to_sort):
    """Sorts a collection using the infamous bogosort algorithm.

    Parameters:
        to_sort - An iterable to be sorted.
    Returns:
        The sorted collection.
    """
    # Be sure to sort the list at each pass in the while loop to make it extra
    # inefficient!
    while sorted(to_sort) != to_sort:
        shuffle(to_sort)

9f58b2d823cc646ddae723adbd5231e2e2cbe73e
<mask token>

<mask token>


def bogosort(to_sort):
    """Sorts a collection using the infamous bogosort algorithm.

    Parameters:
        to_sort - An iterable to be sorted.
    Returns:
        The sorted collection.
    """
    while sorted(to_sort) != to_sort:
        shuffle(to_sort)

from random import shuffle


def bogosort(to_sort):
    """Sorts a collection using the infamous bogosort algorithm.

    Parameters:
        to_sort - An iterable to be sorted.
    Returns:
        The sorted collection.
    """
    while sorted(to_sort) != to_sort:
        shuffle(to_sort)

from random import shuffle

def bogosort(to_sort):
    """Sorts a collection using the infamous bogosort algorithm.

    Parameters:
        to_sort - An iterable to be sorted.
    Returns:
        The sorted collection.
    """
    # Be sure to sort the list at each pass in the while loop to make it extra
    # inefficient!
    while sorted(to_sort) != to_sort:
        shuffle(to_sort)
