'Register ourself to listen for session events, we shut down
if we become lost'

def _establish_sessionwatch(self, state):

    with self._state_change:
        if (state == KazooState.SUSPENDED):
            if (self.state == PartitionState.ACQUIRED):
                self._was_allocated = True
                self.state = PartitionState.ALLOCATING
        elif (state == KazooState.CONNECTED):
            if self._was_allocated:
                self._was_allocated = False
                self.state = PartitionState.ACQUIRED
    if (state == KazooState.LOST):
        self._client.handler.spawn(self._fail_out)
        return True
