parameters: (
          self, timeout: Optional[Union[float, datetime.timedelta]] = None
      )
return_statement: return waiter
docstring: Decrement the counter. Returns an awaitable.
  
          Block if the counter is zero and wait for a `.release`. The awaitable
          raises `.TimeoutError` after the deadline.
docstring_summary: Decrement the counter. Returns an awaitable.
docstring_tokens: Decrement the counter . Returns an awaitable .
function: def acquire(
          self, timeout: Optional[Union[float, datetime.timedelta]] = None
      ) -> Awaitable[_ReleasingContextManager]:
          """Decrement the counter. Returns an awaitable.
  
          Block if the counter is zero and wait for a `.release`. The awaitable
          raises `.TimeoutError` after the deadline.
          """
          waiter = Future()  # type: Future[_ReleasingContextManager]
          if self._value > 0:
              self._value -= 1
              waiter.set_result(_ReleasingContextManager(self))
          else:
              self._waiters.append(waiter)
              if timeout:
  
                  def on_timeout() -> None:
                      if not waiter.done():
                          waiter.set_exception(gen.TimeoutError())
                      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 acquire ( self , timeout : Optional [ Union [ float , datetime . timedelta ] ] = None ) -> Awaitable [ _ReleasingContextManager ] : waiter = Future ( ) # type: Future[_ReleasingContextManager] if self . _value > 0 : self . _value -= 1 waiter . set_result ( _ReleasingContextManager ( self ) ) else : self . _waiters . append ( waiter ) if timeout : def on_timeout ( ) -> None : if not waiter . done ( ) : waiter . set_exception ( gen . TimeoutError ( ) ) 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