def try_acquire(self, permits=<NUM_LIT:1>, timeout=<NUM_LIT:0>):
check_not_negative(permits, "<STR_LIT>")<EOL>return self._encode_invoke(semaphore_try_acquire_codec, permits=permits, timeout=to_millis(timeout))<EOL>
Tries to acquire one or the given number of permits, if they are available, and returns immediately, with the
value ``true``, reducing the number of available permits by the given amount.

If there are insufficient permits and a timeout is provided, the current thread becomes disabled for thread
scheduling purposes and lies dormant until one of following happens:
    * some other thread invokes the release() method for this semaphore and the current thread is next to be
    assigned a permit, or
    * some other thread interrupts the current thread, or
    * the specified waiting time elapses.

If there are insufficient permits and no timeout is provided, this method will return immediately with the value
``false`` and the number of available permits is unchanged.

:param permits: (int), the number of permits to acquire (optional).
:param timeout: (long), the maximum time in seconds to wait for the permit(s) (optional).
:return: (bool), ``true`` if desired amount of permits was acquired, ``false`` otherwise.