PyAtfork provides API to register fork handlers.
PyAtfork is a wrapper for the POSIX Pthreads API pthread_atfork(3). I wrote this module because Python’s ctype library cannot handle this function correctly.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.