def run_task(func):
    """
    Decorator to collect and return generator results, returning a list
    if there are multiple results
    """

    def _wrapped(*a, **k):
        gen = func(*a, **k)
        return _consume_task(gen)

    return _wrapped
Decorator to collect and return generator results, returning a list
    if there are multiple results