@contextmanager<EOL>def working_directory(path):
prev_dir = os.getcwd()<EOL>os.chdir(str(path))<EOL>try:<EOL><INDENT>yield<EOL><DEDENT>finally:<EOL><INDENT>os.chdir(prev_dir)<EOL><DEDENT>
Change working directory and restore the previous on exit