def add_listener(self, member_added=None, member_removed=None, fire_for_existing=False):
registration_id = str(uuid.uuid4())<EOL>self.listeners[registration_id] = (member_added, member_removed)<EOL>if fire_for_existing:<EOL><INDENT>for member in self.get_member_list():<EOL><INDENT>member_added(member)<EOL><DEDENT><DEDENT>return registration_id<EOL>
Adds a membership listener to listen for membership updates, it will be notified when a member is added to
cluster or removed from cluster. There is no check for duplicate registrations, so if you register the listener
twice, it will get events twice.


:param member_added: (Function), function to be called when a member is added to the cluster (optional).
:param member_removed: (Function), function to be called when a member is removed to the cluster (optional).
:param fire_for_existing: (bool), (optional).
:return: (str), registration id of the listener which will be used for removing this listener.