<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def push(self, dir):
 """Push cwd on stack and change to 'dir'. """

        self.stack.append(os.getcwd())
        os.chdir(dir or os.getcwd())