current_terminal_size = get_terminal_size()

def get_terminal_size():
import sys,fcntl,termios,struct
>>> data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')
>>> data
'\x1b\x00y\x00'
>>> struct.unpack('hh',data)
(27, 121)

# rows, columns