'Return a co-routine which runs the task group.'

def __call__(self):

    raised_exceptions = []
    thrown_exceptions = []
    try:
        while any(six.itervalues(self._runners)):
            try:
                for (k, r) in self._ready():
                    r.start()
                    if (not r):
                        del self._graph[k]
                if self._graph:
                    try:
                        (yield)
                    except Exception:
                        thrown_exceptions.append(sys.exc_info())
                        raise
                for (k, r) in self._running():
                    if r.step():
                        del self._graph[k]
            except Exception:
                exc_info = None
                try:
                    exc_info = sys.exc_info()
                    if self.aggregate_exceptions:
                        self._cancel_recursively(k, r)
                    else:
                        self.cancel_all(grace_period=self.error_wait_time)
                    raised_exceptions.append(exc_info)
                finally:
                    del exc_info
            except:
                with excutils.save_and_reraise_exception():
                    self.cancel_all()
        if raised_exceptions:
            if self.aggregate_exceptions:
                raise ExceptionGroup((v for (t, v, tb) in raised_exceptions))
            elif thrown_exceptions:
                six.reraise(*thrown_exceptions[(-1)])
            else:
                six.reraise(*raised_exceptions[0])
    finally:
        del raised_exceptions
        del thrown_exceptions
