code: def wandb_pty(resize=True):
      
      master_fd, slave_fd = pty.openpty()
      # raw mode so carriage returns etc. don't get added by the terminal driver,
      # bash for windows blows up on this so we catch the error and do nothing
      # TODO(adrian): (when) will this be called on windows?
      try:
          tty.setraw(master_fd)
      except termios.error:
          pass
  
      if resize:
          if SIGWINCH_HANDLER is not None:
              SIGWINCH_HANDLER.add_fd(master_fd)
  
      return master_fd, slave_fd
docs: Get a PTY set to raw mode and registered to hear about window size changes.