code: def from_io_control(fobj):
          
          import fcntl, termios, array
          winsize = array.array("H", [0] * 4) # row, col, xpixel, ypixel
          if not fcntl.ioctl(fobj.fileno(), termios.TIOCGWINSZ, winsize, True):
              return winsize[1]
docs: Call TIOCGWINSZ (Terminal I/O Control to Get the WINdow SiZe)
          where ``fobj`` is a file object (e.g. ``sys.stdout``),
          returning the terminal width assigned to that file.
  
          See the ``ioctl``, ``ioctl_list`` and tty_ioctl`` man pages
          for more information.