code: def xterm_to_rgb(xcolor):
      
      assert 0 <= xcolor <= 255
      if xcolor < 16:
          # basic colors
          return BASIC16[xcolor]
      elif 16 <= xcolor <= 231:
          # color cube
          xcolor -= 16
          return (CUBE_STEPS[xcolor // 36 % 6],
                  CUBE_STEPS[xcolor // 6 % 6],
                  CUBE_STEPS[xcolor % 6])
      elif 232 <= xcolor <= 255:
          # gray tone
          c = 8 + (xcolor - 232) * 0x0A
          return (c, c, c)
docs: Convert xterm Color ID to an RGB value
  
      All 256 values are precalculated and stored in :data:`COLOR_TABLE`