#NEWLINE# def _register_callback( self , callback_list , callback , remove = False ) : #NEWLINE# #INDENT# if callable ( callback ) : #NEWLINE# #INDENT# if ( remove and ( callback in callback_list ) ) : #NEWLINE# #INDENT# callback_list . remove ( callback ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not remove ) and ( not ( callback in callback_list ) ) ) : #NEWLINE# #INDENT# callback_list . append ( callback ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise Exception ( 'Callback must be callable.' )