code: def _handle_generator(self, fn):
          
          with self as cassette:
              coroutine = fn(cassette)
              # We don't need to catch StopIteration. The caller (Tornado's
              # gen.coroutine, for example) will handle that.
              to_yield = next(coroutine)
              while True:
                  try:
                      to_send = yield to_yield
                  except Exception:
                      to_yield = coroutine.throw(*sys.exc_info())
                  else:
                      try:
                          to_yield = coroutine.send(to_send)
                      except StopIteration:
                          break
docs: Wraps a generator so that we're inside the cassette context for the
          duration of the generator.