def reg_on_exit(self, callable_object, *args, **kwargs):
        """ Register a function/method to be called on program exit,
        will get executed regardless of successs/failure of the program running """
        persistent = kwargs.pop('persistent', False)
        event = self._create_event(callable_object, 'exit', persistent, *args, **kwargs)
        self.exit_callbacks.append(event)
        return event
def reg_on_exit ( self , callable_object , * args , ** kwargs ) : persistent = kwargs . pop ( 'persistent' , False ) event = self . _create_event ( callable_object , 'exit' , persistent , * args , ** kwargs ) self . exit_callbacks . append ( event ) return event
Register a function/method to be called on program exit,
        will get executed regardless of successs/failure of the program running