def allsame(iterable):
    """Return whether all elements of an iterable are the same.

    The test uses `!=` to compare, and short-circuits at the
    first item that is different.

    If `iterable` is empty, the return value is `True` (like for `all`).

    If `iterable` has just one element, the return value is `True`.

    **CAUTION**: Consumes consumable iterables.
    """
    it = iter(iterable)
    try:
        x0 = next(it)
    except StopIteration:
        return True  # like all(()) is True
    for x in it:
        if x != x0:
            return False
    return True