<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def performInDirectory(dirPath):
 """ Change the current working directory to dirPath before performing an operation, then restore the original working directory after """

    originalDirectoryPath = os.getcwd()
    try:
        os.chdir(dirPath)
        yield
    finally:
        os.chdir(originalDirectoryPath)