code: def plot_forest(
      ax,
      datasets,
      var_names,
      model_names,
      combined,
      combine_dims,
      colors,
      figsize,
      width_ratios,
      linewidth,
      markersize,
      kind,
      ncols,
      hdi_prob,
      quartiles,
      rope,
      ridgeplot_overlap,
      ridgeplot_alpha,
      ridgeplot_kind,
      ridgeplot_truncate,
      ridgeplot_quantiles,
      textsize,
      legend,
      labeller,
      ess,
      r_hat,
      backend_config,
      backend_kwargs,
      show,
  ):
      """Bokeh forest plot."""
      plot_handler = PlotHandler(
          datasets,
          var_names=var_names,
          model_names=model_names,
          combined=combined,
          combine_dims=combine_dims,
          colors=colors,
          labeller=labeller,
      )
  
      if figsize is None:
          if kind == "ridgeplot":
              figsize = (
                  min(14, sum(width_ratios) * 3),
                  plot_handler.fig_height() * 3,
              )
          else:
              figsize = (
                  min(12, sum(width_ratios) * 2),
                  plot_handler.fig_height(),
              )
  
      (
          figsize,
          _,
          _,
          _,
          auto_linewidth,
          auto_markersize,
      ) = _scale_fig_size(figsize, textsize, 1.1, 1)
  
      if linewidth is None:
          linewidth = auto_linewidth
  
      if markersize is None:
          markersize = auto_markersize
  
      if backend_config is None:
          backend_config = {}
  
      backend_config = {
          **backend_kwarg_defaults(
              ("bounds_x_range", "plot.bokeh.bounds_x_range"),
              ("bounds_y_range", "plot.bokeh.bounds_y_range"),
          ),
          **backend_config,
      }
  
      if backend_kwargs is None:
          backend_kwargs = {}
  
      backend_kwargs = {
          **backend_kwarg_defaults(
              ("dpi", "plot.bokeh.figure.dpi"),
          ),
          **backend_kwargs,
      }
      dpi = backend_kwargs.pop("dpi")
  
      if ax is None:
          axes = []
  
          for i, width_r in zip(range(ncols), width_ratios):
              backend_kwargs_i = backend_kwargs.copy()
              backend_kwargs_i.setdefault(
                  "height", int(figsize[1] * dpi)
              )
              backend_kwargs_i.setdefault(
                  "width",
                  int(
                      figsize[0]
                      * (width_r / sum(width_ratios))
                      * dpi
                      * 1.25
                  ),
              )
              ax = bkp.figure(
                  **backend_kwargs_i,
              )
              if i == 0:
                  backend_kwargs.setdefault("y_range", ax.y_range)
              axes.append(ax)
      else:
          axes = ax
  
      axes = np.atleast_2d(axes)
  
      plotted = defaultdict(list)
  
      if kind == "forestplot":
          plot_handler.forestplot(
              hdi_prob,
              quartiles,
              linewidth,
              markersize,
              axes[0, 0],
              rope,
              plotted,
          )
      elif kind == "ridgeplot":
          plot_handler.ridgeplot(
              hdi_prob,
              ridgeplot_overlap,
              linewidth,
              markersize,
              ridgeplot_alpha,
              ridgeplot_kind,
              ridgeplot_truncate,
              ridgeplot_quantiles,
              axes[0, 0],
              plotted,
          )
      else:
          raise TypeError(
              f"Argument 'kind' must be one of 'forestplot' or 'ridgeplot' (you provided {kind})"
          )
  
      idx = 1
      if ess:
          plotted_ess = defaultdict(list)
          plot_handler.plot_neff(axes[0, idx], markersize, plotted_ess)
          if legend:
              plot_handler.legend(axes[0, idx], plotted_ess)
          idx += 1
  
      if r_hat:
          plotted_r_hat = defaultdict(list)
          plot_handler.plot_rhat(
              axes[0, idx], markersize, plotted_r_hat
          )
          if legend:
              plot_handler.legend(axes[0, idx], plotted_r_hat)
          idx += 1
  
      all_plotters = list(plot_handler.plotters.values())
      y_max = plot_handler.y_max() - all_plotters[-1].group_offset
      if kind == "ridgeplot":  # space at the top
          y_max += ridgeplot_overlap
  
      for i, ax_ in enumerate(axes.ravel()):
          if kind == "ridgeplot":
              ax_.xgrid.grid_line_color = None
              ax_.ygrid.grid_line_color = None
          else:
              ax_.ygrid.grid_line_color = None
  
          if i != 0:
              ax_.yaxis.visible = False
  
          ax_.outline_line_color = None
          ax_.x_range = DataRange1d(
              bounds=backend_config["bounds_x_range"], min_interval=1
          )
          ax_.y_range = DataRange1d(
              bounds=backend_config["bounds_y_range"], min_interval=2
          )
  
          ax_.y_range._property_values[
              "start"
          ] = -all_plotters[  # pylint: disable=protected-access
              0
          ].group_offset
          ax_.y_range._property_values[
              "end"
          ] = y_max  # pylint: disable=protected-access
  
      labels, ticks = plot_handler.labels_and_ticks()
      ticks = [
          int(tick) if (tick).is_integer() else tick for tick in ticks
      ]
  
      axes[0, 0].yaxis.ticker = FixedTicker(ticks=ticks)
      axes[0, 0].yaxis.major_label_overrides = dict(
          zip(map(str, ticks), map(str, labels))
      )
  
      if legend:
          plot_handler.legend(axes[0, 0], plotted)
      show_layout(axes, show)
  
      return axes
  
imports: from collections import OrderedDict, defaultdict
  from itertools import cycle, tee
  import bokeh.plotting
  import matplotlib.pyplot
  import numpy
  from bokeh.models import Band, ColumnDataSource, DataRange1d
  from bokeh.models.annotations import Title, Legend
  from bokeh.models.tickers import FixedTicker
  from ....sel_utils import xarray_var_iter
  from ....rcparams import rcParams
  from ....stats import hdi
  from ....stats.density_utils import get_bins, histogram, kde
  from ....stats.diagnostics import _ess, _rhat
  from ....utils import conditional_jit
  from ...plot_utils import _scale_fig_size
  from ..None import show_layout
  from .None import backend_kwarg_defaults
label_desc: Use image node_id 2 for calling a global function with example usage: plot_forest(ax, datasets, var_names, model_names, combined, combine_dims, colors, figsize, width_ratios, linewidth, markersize, kind, ncols, hdi_prob, quartiles, rope, ridgeplot_overlap, ridgeplot_alpha, ridgeplot_kind, ridgeplot_truncate, ridgeplot_quantiles, textsize, legend, labeller, ess, r_hat, backend_config, backend_kwargs, show) and returns: axes