@contextlib.contextmanager<EOL>def temporary_directory():
dir_name = tempfile.mkdtemp()<EOL>yield dir_name<EOL>if os.path.exists(dir_name):<EOL><INDENT>shutil.rmtree(dir_name)<EOL><DEDENT>
make a temporary directory, yeild its name, cleanup on exit