#NEWLINE# def _get_terminal_size( fd ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# res = fcntl . ioctl ( fd , termios . TIOCGWINSZ , ( b'\x00' * 4 ) ) #NEWLINE# ( lines , columns ) = struct . unpack ( 'hh' , res ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# columns = lines = 0 #NEWLINE# #UNINDENT# return ( columns , lines )