def _get_extended_palette_entry(self, name, index, is_hex=False):
values = None<EOL>is_fbterm = (env.TERM == '<STR_LIT>')  <EOL>if '<STR_LIT>' in self._palette_support:  <EOL><INDENT>if is_hex:<EOL><INDENT>index = str(find_nearest_color_hexstr(index,<EOL>method=self._dg_method))<EOL><DEDENT>start_codes = self._start_codes_extended<EOL>if is_fbterm:<EOL><INDENT>start_codes = self._start_codes_extended_fbterm<EOL><DEDENT>values = [start_codes, index]<EOL><DEDENT>elif '<STR_LIT>' in self._palette_support:<EOL><INDENT>if is_hex:<EOL><INDENT>nearest_idx = find_nearest_color_hexstr(index, color_table4,<EOL>method=self._dg_method)<EOL><DEDENT>else:<EOL><INDENT>from .color_tables import index_to_rgb8  <EOL>nearest_idx = find_nearest_color_index(*index_to_rgb8[index],<EOL>color_table=color_table4,<EOL>method=self._dg_method)<EOL><DEDENT>values = self._index_to_ansi_values(nearest_idx)<EOL><DEDENT>return (self._create_entry(name, values, fbterm=is_fbterm)<EOL>if values else empty)<EOL>
Compute extended entry, once on the fly.