PyDocs

Python Runtime Services

atexit

allow programmer to define multiple exit functions to be executed
upon normal program termination.

Two public functions, register and unregister, are defined.
Symbols in atexit

r

register
Register a function to be executed upon normal program termination

u

unregister
Unregister an exit function which was previously registered using atexit.register