<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_listener(self, member_added=None, member_removed=None, fire_for_existing=False):
 """ 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. """

        registration_id = str(uuid.uuid4())
        self.listeners[registration_id] = (member_added, member_removed)

        if fire_for_existing:
            for member in self.get_member_list():
                member_added(member)

        return registration_id