docs: def _get_extended_palette_entry(self, name, index, is_hex=False):
          ''' Compute extended entry, once on the fly. '''
          values = None
          is_fbterm = (env.TERM == 'fbterm')  # sigh
  
          if 'extended' in self._palette_support:  # build entry
              if is_hex:
                  index = str(find_nearest_color_hexstr(index,
                                                        method=self._dg_method))
              start_codes = self._start_codes_extended
              if is_fbterm:
                  start_codes = self._start_codes_extended_fbterm
  
              values = [start_codes, index]
  
          # downgrade section
          elif 'basic' in self._palette_support:
              if is_hex:
                  nearest_idx = find_nearest_color_hexstr(index, color_table4,
                                                          method=self._dg_method)
              else:
                  from .color_tables import index_to_rgb8  # find rgb for idx
                  nearest_idx = find_nearest_color_index(*index_to_rgb8[index],
                                                         color_table=color_table4,
                                                         method=self._dg_method)
              values = self._index_to_ansi_values(nearest_idx)
  
          return (self._create_entry(name, values, fbterm=is_fbterm)
                  if values else empty)