def acquire(self,int mode=1):
        """Lock the lock.  Without argument, this blocks if the lock is already
           locked (even by the same thread), waiting for another thread to release
           the lock, and return None once the lock is acquired.
           With an argument, this will only block if the argument is true,
           and the return value reflects whether the lock is acquired.
           The blocking operation is not interruptible."""
        cdef long candidate
        cdef int result
        cdef PyThreadState* state

        candidate = PyThread_get_thread_ident()
        if self.locked==0 or candidate!=self.locker:
            state=PyEval_SaveThread()
            result = PyThread_acquire_lock(self.lock,mode)
            PyEval_RestoreThread(state)
            if result==1:
                self.locked = 1
                self.locker = candidate
                return True
            else:
                return False
        else:
            self.locked = self.locked + 1
            return True
Lock the lock.  Without argument, this blocks if the lock is already
           locked (even by the same thread), waiting for another thread to release
           the lock, and return None once the lock is acquired.
           With an argument, this will only block if the argument is true,
           and the return value reflects whether the lock is acquired.
           The blocking operation is not interruptible.
recipes/Python/310792_native_implementatithreadingLock_threadingRLock_/recipe-310792.py