<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def work_dir(path):
    '''
    Context menager for executing commands in some working directory.
    Returns to the previous wd when finished.

    Usage:
    >>> with work_dir(path):
    ...   subprocess.call('git status')

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