def TerminalSize():
  try:
    with open(os.ctermid(), 'r') as tty:
      length_width = struct.unpack(
          'hh', fcntl.ioctl(tty.fileno(), termios.TIOCGWINSZ, '1234'))
  except (IOError, OSError):
    try:
      length_width = (int(os.environ['LINES']),
                      int(os.environ['COLUMNS']))
    except (ValueError, KeyError):
      length_width = (24, 80)
  return length_width
test if an update to the vdir is detected by the CalendarCollection
dataset/ETHPy150Open google/textfsm/terminal.py/TerminalSize--crossover with--dataset/ETHPy150Open pimutils/khal/tests/khalendar_test.py/test_default_calendar