def _open_terminal():
 for x in 'pqrstuvwxyzPQRST':
  for y in '0123456789abcdef':
   pty_name = (('/dev/pty' + x) + y)
   try:
    fd = os.open(pty_name, os.O_RDWR)
   except OSError:
    continue
   return (fd, (('/dev/tty' + x) + y))
 raise OSError('out of pty devices')

def _open_terminal ( ) : for x in 'pqrstuvwxyzPQRST' : for y in '0123456789abcdef' : pty_name = ( ( '/dev/pty' + x ) + y ) try : fd = os . open ( pty_name , os . O_RDWR ) except OSError : continue return ( fd , ( ( '/dev/tty' + x ) + y ) ) raise OSError ( 'out of pty devices' )
open pty master and return .