'Stops the `.IOLoop`, causing one pending (or future) call to `wait()`
to return.
Keyword arguments or a single positional argument passed to `stop()` are
saved and will be returned by `wait()`.'

def stop(self, _arg=None, **kwargs):

    assert ((_arg is None) or (not kwargs))
    self.__stop_args = (kwargs or _arg)
    if self.__running:
        self.io_loop.stop()
        self.__running = False
    self.__stopped = True
