code: def until_connected(self, timeout=None):
          
          t0 = self.ioloop.time()
          yield self.until_running(timeout=timeout)
          t1 = self.ioloop.time()
          if timeout:
              timedelta = timeout - (t1 - t0)
          else:
              timedelta = None
          assert get_thread_ident() == self.ioloop_thread_id
          yield self._connected.until_set(timeout=timedelta)
docs: Return future that resolves when the client is connected.