code: def acquire(self, blocking=True, timeout=None):
          
          hub = get_hub()
          try:
              # switcher.__call__ needs to be synchronized with a lock IF it can
              # be called from different threads. This is the case here because
              # this method may be called from multiple threads and the callbacks
              # are run in the calling thread. So pass it our _lock.
              with switch_back(timeout, lock=self._lock) as switcher:
                  with self._lock:
                      if not self._locked:
                          self._locked = 1
                          self._owner = fibers.current()
                          return True
                      elif self._reentrant and self._owner is fibers.current():
                          self._locked += 1
                          return True
                      elif not blocking:
                          return False
                      handle = add_callback(self, switcher)
                  # It is safe to call hub.switch() outside the lock. Another
                  # thread could have called acquire()+release(), thereby firing
                  # the switchback. However the switchback only schedules the
                  # switchback in our hub, it won't execute it yet. So the
                  # switchback won't actually happen until we switch to the hub.
                  hub.switch()
                  # Here the lock should be ours because _release() wakes up only
                  # the fiber that it passed the lock.
                  assert self._locked > 0
                  assert self._owner is fibers.current()
          except BaseException as e:
              # Likely a Timeout but could also be e.g. Cancelled
              with self._lock:
                  # Clean up the callback. It might have been popped by
                  # _release() but that is OK.
                  remove_callback(self, handle)
                  # This fiber was passed the lock but before that an exception
                  # was already scheduled with run_callback() (likely through
                  # Fiber.throw())
                  if self._owner is fibers.current():
                      self._release()
              if e is switcher.timeout:
                  return False
              raise
          return True
docs: Acquire the lock.
  
          If *blocking* is true (the default), then this will block until the
          lock can be acquired. The *timeout* parameter specifies an optional
          timeout in seconds.
  
          The return value is a boolean indicating whether the lock was acquired.