def master_open():
 try:
  (master_fd, slave_fd) = os.openpty()
 except (AttributeError, OSError):
  pass
 else:
  slave_name = os.ttyname(slave_fd)
  os.close(slave_fd)
  return (master_fd, slave_name)
 return _open_terminal()

def master_open ( ) : try : ( master_fd , slave_fd ) = os . openpty ( ) except ( AttributeError , OSError ) : pass else : slave_name = os . ttyname ( slave_fd ) os . close ( slave_fd ) return ( master_fd , slave_name ) return _open_terminal ( )
master_open() -> open a pty master and return the fd .