#NEWLINE# def remove_binding( self , function ) : #NEWLINE# #INDENT# '\n        Remove a key binding.\n\n        This expects a function that was given to `add_binding` method as\n        parameter. Raises `ValueError` when the given function was not\n        registered before.\n        ' #NEWLINE# assert callable ( function ) #NEWLINE# for b in self . key_bindings : #NEWLINE# #INDENT# if ( b . handler == function ) : #NEWLINE# #INDENT# self . key_bindings . remove ( b ) #NEWLINE# self . _keys_to_bindings [ b . keys ] . remove ( b ) #NEWLINE# for i in range ( 1 , len ( b . keys ) ) : #NEWLINE# #INDENT# self . _keys_to_bindings_suffixes [ b . keys [ : i ] ] . remove ( b ) #NEWLINE# #UNINDENT# return #NEWLINE# #UNINDENT# #UNINDENT# raise ValueError ( ( 'Binding not found: %r' % ( function , ) ) )