def shutdown ( self ) : self . run_clean_thread = False self . cleanup ( True ) if self . cleaner_thread . isAlive ( ) : self . cleaner_thread . join ( )
python threading clean up threads
shutdown : to be run by atexit handler . All open connection are closed .
def shutdown(self):
        """
        shutdown: to be run by atexit handler. All open connection are closed.
        """
        self.run_clean_thread = False
        self.cleanup(True)
        if self.cleaner_thread.isAlive():
            self.cleaner_thread.join()