class_docstr: Cache which maps (r, g, b) tuples to 16 ansi colors.
  
  :param bg: Cache for background colors, instead of foreground.
code: def __init__(self, bg=False):
      assert isinstance(bg, bool)
      self.bg = bg
  
imports: from __future__ import unicode_literals
  from prompt_toolkit.filters import to_simple_filter, Condition
  from prompt_toolkit.layout.screen import Size
  from prompt_toolkit.renderer import Output
  from prompt_toolkit.styles import ANSI_COLOR_NAMES
  from six.moves import range
  import array
  import errno
  import os
  import six
label_desc: Use image node_id 1 to create a new _16ColorCache object from inherited base classes: dict with example: obj = _16ColorCache(bg)