code: def pushd(directory: str) -> None:
      
      previous_dir = os.getcwd()
      os.chdir(directory)
      yield
      os.chdir(previous_dir)
docs: Context manager: changes directory and preserves the original on exit.
  
      Example:
  
      .. code-block:: python
  
          with pushd(new_directory):
              # do things