code: def change_dir(self, session, path):
          
          if path == "-":
              # Previous directory
              path = self._previous_path or "."
  
          try:
              previous = os.getcwd()
              os.chdir(path)
          except IOError as ex:
              # Can't change directory
              session.write_line("Error changing directory: {0}", ex)
          else:
              # Store previous path
              self._previous_path = previous
              session.write_line(os.getcwd())
docs: Changes the working directory