docs: def _copy(master_fd, master_read=_read, stdin_read=_read):
      """Parent copy loop.
      Copies
              pty master -> standard output   (master_read)
              standard input -> pty master    (stdin_read)"""
      fds = [master_fd, STDIN_FILENO]
      while True:
          rfds, wfds, xfds = select(fds, [], [])
          if master_fd in rfds:
              data = master_read(master_fd)
              if not data:  # Reached EOF.
                  return
              else:
                  os.write(STDOUT_FILENO, data)
          if STDIN_FILENO in rfds:
              data = stdin_read(STDIN_FILENO)
              if not data:
                  fds.remove(STDIN_FILENO)
              else:
                  _writen(master_fd, data)