Register a function to be executed upon normal program termination func - function to be called at exit args - optional arguments to pass to func kwargs - optional keyword arguments to pass to func func is returned to facilitate usage as a decorator.