<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def new_id(self):
 """ Generates and returns a cluster-wide unique id. Generated ids are guaranteed to be unique for the entire cluster as long as the cluster is live. If the cluster restarts, then id generation will start from 0. :return: (long), cluster-wide new unique id. """

        with self._lock:
            curr = self._residue
            self._residue += 1
            if self._residue >= BLOCK_SIZE:
                increment = self._atomic_long.get_and_increment().result()
                self._local = increment
                self._residue = 0
                return self.new_id()
            return self._local * BLOCK_SIZE + curr