#NEWLINE# def add_listener( self , include_value = False , item_added = None , item_removed = None ) : #NEWLINE# #INDENT# request = queue_add_listener_codec . encode_request ( self . name , include_value , False ) #NEWLINE# def handle_event_item( item , uuid , event_type ) : #NEWLINE# #INDENT# item = ( item if include_value else None ) #NEWLINE# member = self . _client . cluster . get_member_by_uuid ( uuid ) #NEWLINE# item_event = ItemEvent ( self . name , item , event_type , member , self . _to_object ) #NEWLINE# if ( event_type == ItemEventType . added ) : #NEWLINE# #INDENT# if item_added : #NEWLINE# #INDENT# item_added ( item_event ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if item_removed : #NEWLINE# #INDENT# item_removed ( item_event ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return self . _start_listening ( request , ( lambda m : queue_add_listener_codec . handle ( m , handle_event_item ) ) , ( lambda r : queue_add_listener_codec . decode_response ( r ) [ 'response' ] ) , self . partition_key )