import functools


def tuplize(generator):
    """ Takes a generator and make it a tuple-returning function. As a side
    effect, it can also decorate any iterator-returning function to force
    return value to be a tuple.
    """

    @functools.wraps(generator)
    def tuplized(*args, **kwargs):
        return tuple(generator(*args, **kwargs))

    return tuplized