code: def _get_size(fileno):
      # Thanks to fabric (fabfile.org), and
      # http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/
      
      # Inline imports, because these modules are not available on Windows.
      # (This file is used by ConEmuOutput, which is used on Windows.)
      import fcntl
      import termios
  
      # Buffer for the C call
      buf = array.array(b'h' if six.PY2 else u'h', [0, 0, 0, 0])
  
      # Do TIOCGWINSZ (Get)
      # Note: We should not pass 'True' as a fourth parameter to 'ioctl'. (True
      #       is the default.) This causes segmentation faults on some systems.
      #       See: https://github.com/jonathanslenders/python-prompt-toolkit/pull/364
      fcntl.ioctl(fileno, termios.TIOCGWINSZ, buf)
  
      # Return rows, cols
      return buf[0], buf[1]
docs: Get the size of this pseudo terminal.
  
      :param fileno: stdout.fileno()
      :returns: A (rows, cols) tuple.