code: def add_membership_listener(self, member_added=None, member_removed=None, fire_for_existing=False):
          
          self.membership_listeners.append((member_added, member_removed, fire_for_existing))
          return self
docs: Helper method for adding membership listeners
  
          :param member_added: (Function), Function to be called when a member is added, in the form of f(member)
          (optional).
          :param member_removed: (Function), Function to be called when a member is removed, in the form of f(member)
          (optional).
          :param fire_for_existing: if True, already existing members will fire member_added event (optional).
          :return: `self` for cascading configuration