code: def pushd(cls, new_dir):
          
          previous_dir = os.getcwd()
          try:
              new_ab_dir = None
              if os.path.isabs(new_dir):
                  new_ab_dir = new_dir
              else:
                  new_ab_dir = os.path.join(previous_dir, new_dir)
              # Use absolute path to show it on FileNotFoundError message.
              cls.cd(new_ab_dir)
              yield
          finally:
              cls.cd(previous_dir)
docs: Change directory, and back to previous directory.
  
          It behaves like "pushd directory; something; popd".