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))
def _resume ( self , func , * args ) : 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 ) )
Resume the coroutine by throwing a value or returning a value from
        the ``await`` and handle further awaits.