from typing import Iterable


def all_equal(iterable: Iterable):
    """
    Utility function for checking if all the elements in an iterable are equal
    """
    if isinstance(iterable, list):
        return not iterable or iterable.count(iterable[0]) == len(iterable)
    elif isinstance(iterable, tuple):
        return iterable[1:] == iterable[:-1]
    else:
        # This is a generic solution for all iterables, the type checks above are
        # optimized for the respective types.
        it = iter(iterable)
        try:
            first = next(it)
        except StopIteration:
            return True
        return all(first == rest for rest in it)