def add_lifecycle_listener(self, lifecycle_state_changed=None):
if lifecycle_state_changed:<EOL><INDENT>self.lifecycle_listeners.append(lifecycle_state_changed)<EOL><DEDENT>return self<EOL>
Helper method for adding lifecycle listeners.

:param lifecycle_state_changed: (Function), Function to be called when lifecycle state is changed (optional).
In the form of f(state).
:return: `self` for cascading configuration