def clean_tmpdir ( path ) : if os . path . exists ( path ) and os . path . isdir ( path ) : rmtree ( path )
python how to exit current directory
Invoked atexit this removes our tmpdir
def clean_tmpdir(path):
    """Invoked atexit, this removes our tmpdir"""
    if os.path.exists(path) and \
       os.path.isdir(path):
        rmtree(path)