class_docstr: Cache which maps (r, g, b) tuples to 16 ansi colors.
  
  :param bg: Cache for background colors, instead of foreground.
code: def _get(self, value, exclude=()):
      r, g, b = value
      match = _get_closest_ansi_color(r, g, b, exclude=exclude)
  
      # Turn color name into code.
      if self.bg:
          code = BG_ANSI_COLORS[match]
      else:
          code = FG_ANSI_COLORS[match]
  
      self[value] = code
      return code, match
  
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 3 for calling the _16ColorCache obj's underlying member method code with example usage: obj._get(value, exclude) and returns: code,  match