def _wrapped_call(wrap_controller, func):
 try:
  next(wrap_controller)
 except StopIteration:
  _raise_wrapfail(wrap_controller, 'did not yield')
 call_outcome = _CallOutcome(func)
 try:
  wrap_controller.send(call_outcome)
  _raise_wrapfail(wrap_controller, 'has second yield')
 except StopIteration:
  pass
 return call_outcome.get_result()

def _wrapped_call ( wrap_controller , func ) : try : next ( wrap_controller ) except StopIteration : _raise_wrapfail ( wrap_controller , 'did not yield' ) call_outcome = _CallOutcome ( func ) try : wrap_controller . send ( call_outcome ) _raise_wrapfail ( wrap_controller , 'has second yield' ) except StopIteration : pass return call_outcome . get_result ( )
wrap calling to a function with a generator which needs to yield exactly once .