human
I wrote the below code

    @six.wraps(task)
    def wrapper(*args, **kwargs):
        parent = task(*args, **kwargs)
        try:
            subtask = next(parent)
        except StopIteration:
            return
        while True:
            try:
                if isinstance(subtask, types.GeneratorType):
                    subtask_running = True
                    try:
                        step = next(subtask)
                    except StopIteration:
                        subtask_running = False
                    while subtask_running:
                        try:
                            (yield step)
                        except GeneratorExit:
                            subtask.close()
                            raise
                        except:
                            try:
                                step = subtask.throw(*sys.exc_info())
                            except StopIteration:
                                subtask_running = False
                        else:
                            try:
                                step = next(subtask)
                            except StopIteration:
                                subtask_running = False
                else:
                    (yield subtask)
            except GeneratorExit:
                parent.close()
                raise
            except:
                try:
                    subtask = parent.throw(*sys.exc_info())
                except StopIteration:
                    return
            else:
                try:
                    subtask = next(parent)
                except StopIteration:
                    return
    return wrapper

What's a good function header?
 ... Here's a good function header?
assistant
#Here's a good function header.

def wrappertask(task):