code: def dimensions(self):
          
          try:
              call = fcntl.ioctl(self.termfd, termios.TIOCGWINSZ, "\000" * 8)
          except IOError:
              return (79, 40)
          else:
              height, width = struct.unpack("hhhh", call)[:2]
              return (width, height)
docs: Returns terminal dimensions
  
          Don't save this information for long periods of time because
          the user might resize their terminal.
  
          :return: Returns ``(width, height)``.  If there's no terminal
                   to be found, we'll just return ``(79, 40)``.