parameters: (
          self, timeout: Optional[Union[float, datetime.timedelta]] = None
      )
return_statement: return waiter
docstring: Wait for `.notify`.
  
          Returns a `.Future` that resolves ``True`` if the condition is notified,
          or ``False`` after a timeout.
docstring_summary: Wait for `.notify`.
docstring_tokens: Wait for . notify .
function: def wait(
          self, timeout: Optional[Union[float, datetime.timedelta]] = None
      ) -> Awaitable[bool]:
          """Wait for `.notify`.
  
          Returns a `.Future` that resolves ``True`` if the condition is notified,
          or ``False`` after a timeout.
          """
          waiter = Future()  # type: Future[bool]
          self._waiters.append(waiter)
          if timeout:
  
              def on_timeout() -> None:
                  if not waiter.done():
                      future_set_result_unless_cancelled(waiter, False)
                  self._garbage_collect()
  
              io_loop = ioloop.IOLoop.current()
              timeout_handle = io_loop.add_timeout(timeout, on_timeout)
              waiter.add_done_callback(lambda _: io_loop.remove_timeout(timeout_handle))
          return waiter
function_tokens: def wait ( self , timeout : Optional [ Union [ float , datetime . timedelta ] ] = None ) -> Awaitable [ bool ] : waiter = Future ( ) # type: Future[bool] self . _waiters . append ( waiter ) if timeout : def on_timeout ( ) -> None : if not waiter . done ( ) : future_set_result_unless_cancelled ( waiter , False ) self . _garbage_collect ( ) io_loop = ioloop . IOLoop . current ( ) timeout_handle = io_loop . add_timeout ( timeout , on_timeout ) waiter . add_done_callback ( lambda _ : io_loop . remove_timeout ( timeout_handle ) ) return waiter