code: def acquire(self, timeout=10):
          
          stop = (
              tenacity.stop_never
              if timeout is None else tenacity.stop_after_delay(timeout)
          )
  
          def wait(previous_attempt_number, delay_since_first_attempt):
              if timeout is None:
                  remaining_timeout = None
              else:
                  remaining_timeout = max(timeout - delay_since_first_attempt, 0)
              # TODO(jd): Wait for a DELETE event to happen: that'd mean the lock
              # has been released, rather than retrying on PUT events too
              try:
                  self.etcd_client.watch_once(self.key, remaining_timeout)
              except exceptions.WatchTimedOut:
                  pass
              return 0
  
          @tenacity.retry(retry=tenacity.retry_never,
                          stop=stop,
                          wait=wait)
          def _acquire():
              # TODO: save the created revision so we can check it later to make
              # sure we still have the lock
  
              self.lease = self.etcd_client.lease(self.ttl)
  
              success, _ = self.etcd_client.transaction(
                  compare=[
                      self.etcd_client.transactions.create(self.key) == 0
                  ],
                  success=[
                      self.etcd_client.transactions.put(self.key, self.uuid,
                                                        lease=self.lease)
                  ],
                  failure=[
                      self.etcd_client.transactions.get(self.key)
                  ]
              )
              if success is True:
                  return True
              self.lease = None
              raise tenacity.TryAgain
  
          try:
              return _acquire()
          except tenacity.RetryError:
              return False
docs: Acquire the lock.
  
          :params timeout: Maximum time to wait before returning. `None` means
                           forever, any other value equal or greater than 0 is
                           the number of seconds.
          :returns: True if the lock has been acquired, False otherwise.