@contextmanager<EOL>def excursion(directory):
old_dir = os.getcwd()<EOL>try:<EOL><INDENT>os.chdir(directory)<EOL>yield<EOL><DEDENT>finally:<EOL><INDENT>os.chdir(old_dir)<EOL><DEDENT>
Context-manager that temporarily changes to a new working directory.