@contextlib.contextmanager<EOL>def cd(path):
old_dir = os.getcwd()<EOL>try:<EOL><INDENT>os.makedirs(path)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>os.chdir(path)<EOL>try:<EOL><INDENT>yield<EOL><DEDENT>finally:<EOL><INDENT>os.chdir(old_dir)<EOL><DEDENT>
Creates the path if it doesn't exist