code: def get_column_key(
      label: tuple[str, ...], metrics: list[str]
  ) -> tuple[Any, ...]:
      """
      Sort columns when combining metrics.
  
      MultiIndex labels have the metric name as the last element in the
      tuple. We want to sort these according to the list of passed metrics.
      """
      parts: list[Any] = list(label)
      metric = parts[-1]
      parts[-1] = metrics.index(metric)
      return tuple(parts)
  
file_path: superset/superset/charts/post_processing.py
imports: from io import StringIO
  from typing import Any, Optional, TYPE_CHECKING, Union
  import pandas
  from flask_babel import gettext
  from superset.common.chart_data import ChartDataResultFormat
  from superset.utils.core import extract_dataframe_dtypes, get_column_names, get_metric_names
label_desc: Use image node_id 1 for calling a global function with example usage: get_column_key(label, metrics) and returns: tuple