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 int result
        cdef PyThreadState* state
        # this is the equivalent of Py_BEGIN_ALLOW_THREADS
        state=PyEval_SaveThread()
        result = PyThread_acquire_lock(self.lock,mode)
        # this is the equivalent of Py_END_ALLOW_THREADS
        PyEval_RestoreThread(state)
        if result==1:
            self.locked = 1
            return True
        else:
            return False
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