<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def coroutine(func):
 """ A decorator to wrap a generator function into a callable interface. 2 5 Traceback (most recent call last):
 StopIteration As you can see, this lets you keep state between calls easily, as expected from a generator, while calling the function looks like a function. The same without `@coroutine` would look like this: 0 2 5 Traceback (most recent call last):
 StopIteration Here is an example that shows how to translate traditional functions to use this decorator: 3 6 3 6 The two differences are that a) using traditional functions, func1 and func2 don't share any context and b) using the decorator, both calls use the same function name, and calling the function is limited to wice (in this case). """


    def decorator(*args, **kwargs):
        generator = func(*args, **kwargs)
        next(generator)
        return lambda *args: generator.send(args)
    return decorator