code: def _render_density(
      table: alt.Data,
      *,
      name: str,
      x_name: str,
      line_color: str,
      range_color: str,
      levels: int,
      alpha: float,
      selection=None,
      x_scale: alt.Scale = alt.Undefined,
      y_scale: alt.Scale = alt.Undefined,
  ) -> alt.Chart:
      areas: List[alt.Chart] = []
      for i in range(1, levels):
          y = f"v{5 - i}:Q"
          y2 = f"v{5 + i}:Q"
  
          areas.append(
              alt.Chart(table)
              .mark_area(opacity=alpha**i)
              .encode(
                  x=alt.X("step:Q", scale=x_scale),
                  y=alt.Y(y, scale=y_scale),
                  y2=alt.Y2(y2),
                  color=alt.value(range_color),
              )
          )
  
      line: alt.Chart = (
          alt.Chart(table)
          .mark_line()
          .encode(
              x=alt.X("step:Q", scale=x_scale, title=x_name),
              y=alt.Y("v5:Q", scale=y_scale, title=name),
              color=alt.value(line_color),
          )
      )
      if selection is not None:
          line = line.add_selection(selection)
  
      areas_sum = None
      for a in areas:
          if areas_sum is None:
              areas_sum = a
          else:
              areas_sum += a
  
      if areas_sum is None:
          return line
      else:
          return areas_sum + line
  
imports: from typing import List
  import altair
  from labml.internal.analytics.altair.utils import TABLEAU_10
label_desc: Use image node_id 2 for calling a global function with example usage: _render_density(table) and returns: line, unknown