code: def _convert_color_idxs_to_scaled_rgb_colors(
      color_idxs: np.ndarray,
  ) -> np.ndarray:
      colormap = "RdYlBu_r"
      if plotly_is_available:
          # sample_colorscale requires plotly >= 5.0.0.
          labeled_colors = plotly.colors.sample_colorscale(
              colormap, color_idxs
          )
          scaled_rgb_colors = np.array(
              [plotly.colors.unlabel_rgb(cl) for cl in labeled_colors]
          )
          return scaled_rgb_colors
      else:
          cmap = matplotlib_plt.get_cmap(colormap)
          colors = cmap(color_idxs)[:, :3]  # Drop alpha values.
          rgb_colors = np.asarray(colors * 255, dtype=int)
          return rgb_colors
  
imports: from __future__ import annotations
  import math
  import typing
  from typing import Any
  from typing import Callable
  from typing import NamedTuple
  import numpy
  from optuna._experimental import experimental_func
  from optuna.logging import get_logger
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.study import Study
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
  from optuna.visualization._plotly_imports import _imports
  from optuna.visualization._utils import _check_plot_args
  from optuna.visualization._utils import _is_log_scale
  from optuna.visualization._utils import _is_numerical
  from optuna.visualization.matplotlib._matplotlib_imports import _imports
label_desc: Use image node_id 9 for calling a global function with example usage: _convert_color_idxs_to_scaled_rgb_colors(color_idxs) and returns: scaled_rgb_colors, rgb_colors