def acquire(self, blocking=<NUM_LIT:1>):
rc = False<EOL>with self.__cond:<EOL><INDENT>while self.__value == <NUM_LIT:0>:<EOL><INDENT>if not blocking:<EOL><INDENT>break<EOL><DEDENT>if __debug__:<EOL><INDENT>self._note("<STR_LIT>",<EOL>self, blocking, self.__value)<EOL><DEDENT>self.__cond.wait()<EOL><DEDENT>else:<EOL><INDENT>self.__value = self.__value - <NUM_LIT:1><EOL>if __debug__:<EOL><INDENT>self._note("<STR_LIT>",<EOL>self, self.__value)<EOL><DEDENT>rc = True<EOL><DEDENT><DEDENT>return rc<EOL>
Acquire a semaphore, decrementing the internal counter by one.

        When invoked without arguments: if the internal counter is larger than
        zero on entry, decrement it by one and return immediately. If it is zero
        on entry, block, waiting until some other thread has called release() to
        make it larger than zero. This is done with proper interlocking so that
        if multiple acquire() calls are blocked, release() will wake exactly one
        of them up. The implementation may pick one at random, so the order in
        which blocked threads are awakened should not be relied on. There is no
        return value in this case.

        When invoked with blocking set to true, do the same thing as when called
        without arguments, and return true.

        When invoked with blocking set to false, do not block. If a call without
        an argument would block, return false immediately; otherwise, do the
        same thing as when called without arguments, and return true.