SageMath has various modules to provide access to low-level Python internals.
Utilities for interfacing with the standard library’s atexit module.