code: def term_width():
      
      if fcntl and termios:
          try:
              winsize = fcntl.ioctl(0, termios.TIOCGWINSZ, '    ')
              _, width = struct.unpack('hh', winsize)
              return width
          except IOError:
              pass
      elif windll and create_string_buffer:  # pragma: no cover (windows)
          stderr_handle, struct_size = -12, 22
          handle = windll.kernel32.GetStdHandle(stderr_handle)
          csbi = create_string_buffer(struct_size)
          res = windll.kernel32.GetConsoleScreenBufferInfo(handle, csbi)
          if res:
              (_, _, _, _, _, left, _, right, _,
               _, _) = struct.unpack('hhhhHhhhhhh', csbi.raw)
              return right - left + 1
          else:
              return 0
docs: Return the column width of the terminal, or ``None`` if it can't be
      determined.