'Block until the internal flag is true.
Returns a Future, which raises `tornado.util.TimeoutError` after a
timeout.'

def wait(self, timeout=None):

    if (timeout is None):
        return self._future
    else:
        return gen.with_timeout(timeout, self._future)
