import functools


def coroutine(fn):
    """ Decorator to simplify coroutine initialization """
    @functools.wraps(fn)
    def deco(*args, **kwargs):
        cr = fn(*args, **kwargs)
        cr.next()
        return cr
    return deco