@contextlib.contextmanager
def cwd(path):
    original_cwd = os.getcwd()
    os.chdir(path)
    try:
        (yield)
    finally:
        os.chdir(original_cwd)
@contextlib.contextmanager
def cwd(path):
    original_cwd = os.getcwd()
    os.chdir(path)
    try:
        (yield)
    finally:
        os.chdir(original_cwd)