<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def chdir(path):
 """Change the working directory to `path` for the duration of this context manager. :param str path: The path to change to """

    cur_cwd = os.getcwd()
    os.chdir(path)
    try:
        yield
    finally:
        os.chdir(cur_cwd)