code: def __draw_bubbles(
      plot_table,
      metrics,
      ref_group,
      scales,
      selection,
  ):
      """Draws the bubbles for all metrics."""
  
      # X AXIS GRIDLINES
      axis_values = __get_x_axis_values(scales["x"].domain, zero=False)
  
      x_axis = alt.Axis(
          values=axis_values,
          ticks=False,
          domain=False,
          labels=False,
          title=None,
          gridColor=Axis.grid_color,
      )
  
      # COLOR
      bubble_color_encoding = alt.condition(
          selection,
          alt.Color(
              "attribute_value:N", scale=scales["color"], legend=None
          ),
          alt.value(Bubble.color_faded),
      )
  
      plot_table["tooltip_group_size"] = plot_table.apply(
          lambda row: get_tooltip_text_group_size(
              row["group_size"], row["total_entities"]
          ),
          axis=1,
      )
  
      # CHART INITIALIZATION
      bubble_centers = alt.Chart().mark_point()
      bubble_areas = alt.Chart().mark_circle()
  
      # LAYERING THE METRICS
      for metric in metrics:
          plot_table[
              f"tooltip_disparity_explanation_{metric}"
          ] = plot_table.apply(
              lambda row: get_tooltip_text_disparity_explanation(
                  row[f"{metric}_disparity_scaled"],
                  row["attribute_value"],
                  metric,
                  ref_group,
              ),
              axis=1,
          )
  
          bubble_tooltip_encoding = [
              alt.Tooltip(
                  field="attribute_value",
                  type="nominal",
                  title=Label.SINGLE_GROUP,
              ),
              alt.Tooltip(
                  field="tooltip_group_size",
                  type="nominal",
                  title=Label.GROUP_SIZE,
              ),
              alt.Tooltip(
                  field=f"tooltip_disparity_explanation_{metric}",
                  type="nominal",
                  title=Label.DISPARITY,
              ),
              alt.Tooltip(
                  field=f"{metric}",
                  type="quantitative",
                  format=".2f",
                  title=f"{metric}".upper(),
              ),
          ]
  
          # BUBBLE CENTERS
          trigger_centers = alt.selection_multi(
              empty="all", fields=["attribute_value"]
          )
  
          bubble_centers += (
              alt.Chart(plot_table)
              .transform_calculate(
                  metric_variable=f"'{metric.upper()}'"
              )
              .mark_point(
                  filled=True,
                  size=Bubble.center_size,
                  cursor=Bubble.cursor,
              )
              .encode(
                  x=alt.X(
                      f"{metric}_disparity_scaled:Q",
                      scale=scales["x"],
                      axis=x_axis,
                  ),
                  y=alt.Y(
                      "metric_variable:N",
                      scale=scales["y"],
                      axis=no_axis(),
                  ),
                  tooltip=bubble_tooltip_encoding,
                  color=bubble_color_encoding,
                  shape=alt.Shape(
                      "attribute_value:N",
                      scale=scales["shape"],
                      legend=None,
                  ),
              )
              .add_selection(trigger_centers)
          )
  
          # BUBBLE AREAS
          trigger_areas = alt.selection_multi(
              empty="all", fields=["attribute_value"]
          )
  
          bubble_areas += (
              alt.Chart(plot_table)
              .mark_circle(opacity=Bubble.opacity, cursor=Bubble.cursor)
              .transform_calculate(
                  metric_variable=f"'{metric.upper()}'"
              )
              .encode(
                  x=alt.X(
                      f"{metric}_disparity_scaled:Q",
                      scale=scales["x"],
                      axis=x_axis,
                  ),
                  y=alt.Y(
                      "metric_variable:N",
                      scale=scales["y"],
                      axis=no_axis(),
                  ),
                  tooltip=bubble_tooltip_encoding,
                  color=bubble_color_encoding,
                  size=alt.Size(
                      "group_size:Q",
                      legend=None,
                      scale=scales["bubble_size"],
                  ),
              )
              .add_selection(trigger_areas)
          )
  
      return bubble_areas + bubble_centers
  
imports: import math
  import altair
  import pandas
  from aequitas.plot.commons.helpers import no_axis, transform_ratio, get_chart_metadata
  from aequitas.plot.commons.legend import draw_legend
  from aequitas.plot.commons.scales import get_chart_size_range
  from aequitas.plot.commons.tooltips import get_tooltip_text_group_size, get_tooltip_text_disparity_explanation
  from aequitas.plot.commons.style.classes import Metric_Axis, Axis, Annotation, Reference_Rule, Threshold_Rule, Threshold_Band, Bubble, Chart_Title
  from aequitas.plot.commons.style.text import FONT, FONT_SIZE_SMALL
  from aequitas.plot.commons.style.sizes import Disparity_Chart
  from aequitas.plot.commons import initializers
  from aequitas.plot.commons import labels
label_desc: Use image node_id 11 for calling a global function with example usage: __draw_bubbles(plot_table, metrics, ref_group, scales, selection) and returns: unknown