python atexit class method