from functools import wraps


def consumer(func):
    """A decorator, advances func to its first yield point when called.

    Modifed this original example code from PEP 342 to use the new
    functools.wraps decorator. This convenience function makes it look
    like the original function, which is almost always what we want,
    especially if we designed the original function to be wrapped in
    the first place!

    Maybe `consumer` should go into functools too!
    """


    @wraps(func)
    def wrapper(*args,**kw):
        gen = func(*args, **kw)
        gen.next()
        return gen
    return wrapper