class_docstr: I/O abstraction for rendering to Windows consoles.
  (cmd.exe and similar.)
class_docstr_tok: ["I\/O","abstraction","for","rendering","to","Windows","consoles",".","(","cmd.exe","and","similar",".",")"]
code: def set_attributes(self, attrs):
      fgcolor, bgcolor, bold, underline, italic, blink, reverse = attrs
  
      # Start from the default attributes.
      attrs = self.default_attrs
  
      # Override the last four bits: foreground color.
      if fgcolor is not None:
          attrs = attrs & ~0xF
          attrs |= self.color_lookup_table.lookup_fg_color(fgcolor)
  
      # Override the next four bits: background color.
      if bgcolor is not None:
          attrs = attrs & ~0xF0
          attrs |= self.color_lookup_table.lookup_bg_color(bgcolor)
  
      # Reverse: swap these four bits groups.
      if reverse:
          attrs = (
              (attrs & ~0xFF)
              | ((attrs & 0xF) << 4)
              | ((attrs & 0xF0) >> 4)
          )
  
      self._winapi(
          windll.kernel32.SetConsoleTextAttribute, self.hconsole, attrs
      )
  
imports: from __future__ import unicode_literals
  from ctypes import windll, byref, ArgumentError, c_char, c_long, c_ulong, c_uint, pointer
  from ctypes.wintypes import DWORD, HANDLE
  from prompt_toolkit.renderer import Output
  from prompt_toolkit.styles import ANSI_COLOR_NAMES
  from prompt_toolkit.win32_types import CONSOLE_SCREEN_BUFFER_INFO, STD_OUTPUT_HANDLE, STD_INPUT_HANDLE, COORD, SMALL_RECT
  import os
  import six
label_desc: Use image node_id 16 for calling the Win32Output obj's underlying member method code with example usage: obj.set_attributes(attrs) without return types