code: def _get_y_encoding(
      df: pd.DataFrame,
      y_column: str | None,
      y_from_user: str | Sequence[str] | None,
  ) -> alt.Y:
      import altair as alt
  
      if y_column is None:
          # If no field is specified, the full axis disappears when no data is present.
          # Maybe a bug in vega-lite? So we pass a field that doesn't exist.
          y_field = NON_EXISTENT_COLUMN_NAME
          y_title = ""
      elif y_column == MELTED_Y_COLUMN_NAME:
          # If the y column name is the crazy anti-collision name we gave it, then need to set
          # up a title so we never show the crazy name to the user.
          y_field = y_column
          # Don't show a label in the y axis (not even a nice label like
          # MELTED_Y_COLUMN_TITLE) when we pull the x axis from the index.
          y_title = ""
      else:
          y_field = y_column
  
          # Only show a label in the y axis if the user passed a column explicitly. We
          # could go either way here, but I'm keeping this to avoid breaking the existing
          # behavior.
          if y_from_user is None:
              y_title = ""
          else:
              y_title = y_column
  
      return alt.Y(
          field=y_field,
          title=y_title,
          type=_get_y_encoding_type(df, y_column),
          scale=_get_scale(df, y_column),
          axis=_get_axis_config(df, y_column, grid=True),
      )
  
imports: from __future__ import annotations
  from contextlib import nullcontext
  from datetime import date
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Collection, Dict, List, Sequence, Tuple, cast
  import pandas
  from pandas.api.types import infer_dtype, is_integer_dtype
  from typing_extensions import Literal
  import streamlit.elements.arrow_vega_lite
  from streamlit import type_util
  from streamlit.color_util import Color, is_color_like, is_color_tuple_like, is_hex_color_like, to_css_color
  from streamlit.elements.altair_utils import AddRowsMetadata
  from streamlit.elements.arrow import Data
  from streamlit.elements.utils import last_index_for_melted_dataframes
  from streamlit.errors import Error, StreamlitAPIException
  from streamlit.proto.ArrowVegaLiteChart_pb2 import ArrowVegaLiteChart
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 17 for calling a global function with example usage: _get_y_encoding(df, y_column, y_from_user) and returns: alt