def stop(self):
        """Stops the instance.

        :raises RuntimeError: has not been started.
        :raises TypeError: :meth:`run` is not canonical.

        """
        if not self.is_running():
            raise RuntimeError('Not started')
        running, self._running = self._running, None
        try:
            next(running)
        except __HOLE__:
            # expected.
            pass
        else:
            raise TypeError('run() must yield just one time')
dataset/ETHPy150Open what-studio/profiling/profiling/utils.py/Runnable.stop