def acquire(self) -> bool:
        """
        Acquire the lock. Connect to the Zookeeper server if not connected.

        Returns:
            bool: True if the lock is acquired, raise an exception otherwise.
        Raises:
            BackendCommunicationError: If the Zookeeper client cannot connect to the server.
            ZookeeperLockNotAcquiredError: If the lock cannot be acquired within the timeout period.
        """
        if self._zookeeper_client.state != KazooState.CONNECTED:
            try:
                self._zookeeper_client.start()
            except KazooTimeoutError as e:
                raise BackendCommunicationError("Marqo cannot connect to Zookeeper") from e
        try:
            acquired = self._lock.acquire(timeout=self._acquire_timeout)
            if not acquired:
                raise ZookeeperLockNotAcquiredError("Failed to acquire the lock")
            else:
                return True
        except ConnectionClosedError as e:
            raise BackendCommunicationError("Marqo cannot connect to Zookeeper") from e
        except LockTimeout:
            raise ZookeeperLockNotAcquiredError("Failed to acquire the lock")

        Acquire the lock. Connect to the Zookeeper server if not connected.

        Returns:
            bool: True if the lock is acquired, raise an exception otherwise.
        Raises:
            BackendCommunicationError: If the Zookeeper client cannot connect to the server.
            ZookeeperLockNotAcquiredError: If the lock cannot be acquired within the timeout period.
        
src/marqo/core/distributed_lock/zookeeper_distributed_lock.py