<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _resume(self, func, *args):
 """Resume the coroutine by throwing a value or returning a value from the ``await`` and handle further awaits."""

        try:
            value = func(*args)
        except StopIteration:
            self._generator.close()
            self.set_result(None)
        except Exception as e:
            self._generator.close()
            self.set_exception(e)
        else:
            assert isinstance(value, Future)
            value.callbacks.append(partial(self._resume, self._generator.send))
            value.errbacks.append(partial(self._resume, self._generator.throw))