docs: def get_terminal_size():
      """"
      Return the size of the terminal as (nrow, ncols)
  
      Based on:
  
          http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
      """
      try:
          rc = os.popen('stty size', 'r').read().split()
          return int(rc[0]), int(rc[1])
      except:
          pass
  
      env = os.environ
  
      def ioctl_GWINSZ(fd):
          try:
              import fcntl, termios, struct
              rc = struct.unpack('hh',
                                 fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
              return rc
          except:
              return None
  
      rc = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
  
      if not rc:
          try:
              fd = os.open(os.ctermid(), os.O_RDONLY)
              rc = ioctl_GWINSZ(fd)
              os.close(fd)
          except:
              pass
  
      if not rc:
          rc = (env.get('LINES', 25), env.get('COLUMNS', 80))
  
      return int(rc[0]), int(rc[1])