'Add a function to be called for connection state changes.
This function will be called with a
:class:`~kazoo.protocol.states.KazooState` instance indicating
the new connection state on state transitions.
.. warning::
This function must not block. If its at all likely that it
might need data or a value that could result in blocking
than the :meth:`~kazoo.interfaces.IHandler.spawn` method
should be used so that the listener can return immediately.'

def add_listener(self, listener):

    if (not (listener and callable(listener))):
        raise ConfigurationError('listener    must    be    callable')
    self.state_listeners.add(listener)
