'Acquire the semaphore. By defaults blocks and waits forever.
:param blocking: Block until semaphore is obtained or
return immediately.
:type blocking: bool
:param timeout: Don\'t wait forever to acquire the semaphore.
:type timeout: float or None
:returns: Was the semaphore acquired?
:rtype: bool
:raises:
ValueError if the max_leases value doesn\'t match the
stored value.
:exc:`~kazoo.exceptions.LockTimeout` if the semaphore
wasn\'t acquired within `timeout` seconds.
.. versionadded:: 1.1
The blocking, timeout arguments and the max_leases check.'

def acquire(self, blocking=True, timeout=None):

    self.cancelled = False
    try:
        self.is_acquired = self.client.retry(self._inner_acquire, blocking=blocking, timeout=timeout)
    except KazooException:
        self._best_effort_cleanup()
        self.cancelled = False
        raise
    return self.is_acquired
