def rm_handler(app, handler_name, func, key=None):
 handler_funcs_name = '{0}_funcs'.format(handler_name)
 handler_funcs = getattr(app, handler_funcs_name)
 try:
  handler_funcs.get(key, []).remove(func)
 except ValueError:
  pass

def rm_handler ( app , handler_name , func , key = None ) : handler_funcs_name = '{0}_funcs' . format ( handler_name ) handler_funcs = getattr ( app , handler_funcs_name ) try : handler_funcs . get ( key , [ ] ) . remove ( func ) except ValueError : pass
remove a handler from an application .