class_docstr: Cache for VT100 escape codes. It maps
  (fgcolor, bgcolor, bold, underline, reverse) tuples to VT100 escape sequences.
  
  :param true_color: When True, use 24bit colors instead of 256 colors.
docstr: Return a tuple with the vt100 values  that represent this color. 
docstr_tok: ["Return","a","tuple","with","the","vt100","values","that","represent","this","color","."]
code: def _colors_to_code(self, fg_color, bg_color):
      "Return a tuple with the vt100 values  that represent this color."
      # When requesting ANSI colors only, and both fg/bg color were converted
      # to ANSI, ensure that the foreground and background color are not the
      # same. (Unless they were explicitely defined to be the same color.)
      fg_ansi = [()]
  
      def get(color, bg):
          table = BG_ANSI_COLORS if bg else FG_ANSI_COLORS
  
          if color is None:
              return ()
  
          # 16 ANSI colors. (Given by name.)
          elif color in table:
              return (table[color],)
  
          # RGB colors. (Defined as 'ffffff'.)
          else:
              try:
                  rgb = self._color_name_to_rgb(color)
              except ValueError:
                  return ()
  
              # When only 16 colors are supported, use that.
              if self.ansi_colors_only():
                  if bg:  # Background.
                      if fg_color != bg_color:
                          exclude = (fg_ansi[0],)
                      else:
                          exclude = ()
                      code, name = _16_bg_colors.get_code(
                          rgb, exclude=exclude
                      )
                      return (code,)
                  else:  # Foreground.
                      code, name = _16_fg_colors.get_code(rgb)
                      fg_ansi[0] = name
                      return (code,)
  
              # True colors. (Only when this feature is enabled.)
              elif self.true_color:
                  r, g, b = rgb
                  return (48 if bg else 38, 2, r, g, b)
  
              # 256 RGB colors.
              else:
                  return (48 if bg else 38, 5, _256_colors[rgb])
  
      result = []
      result.extend(get(fg_color, False))
      result.extend(get(bg_color, True))
  
      return map(six.text_type, result)
  
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 4 for calling the _EscapeCodeCache obj's underlying member method code with example usage: obj._colors_to_code(fg_color, bg_color) and returns: map, , table, , code, code, unknown,  int,  r,  g,  b, unknown,  int,  _256_colors