def rev(iterable):
    """Reverse an iterable.

    If a sequence, the return value is ``reversed(iterable)``.

    Otherwise the return value is ``reversed(tuple(iterable))``.

    Hence generators will be fully evaluated until they stop; the input
    ``iterable`` must be finite for ``rev`` to make any sense.
    """
    try:
        return reversed(iterable)
    except TypeError:
        return reversed(tuple(iterable))
