code: def totals_by_stage(d: pd.DataFrame) -> alt.Chart:
      """Plots total runtimes for each stage.
  
      Args:
        d: A dataframe of runtimes.
  
      Returns:
        An altair chart.
      """
      stage_totals_series = d.sum()[RUNTIME_COLUMNS]
      stage_totals = pd.DataFrame(
          stage_totals_series, columns=["Runtime (seconds)"]
      )
      stage_totals.reset_index(inplace=True)
      stage_totals = stage_totals.rename(columns={"index": "Stage"})
      stage_totals["Runtime"] = stage_totals["Runtime (seconds)"].apply(
          format_runtime_string
      )
      return (
          alt.Chart(stage_totals)
          .mark_bar()
          .encode(
              x="Runtime (seconds)",
              y=alt.Y("Stage", sort=None),
              tooltip=["Runtime"],
              fill=alt.Fill("Stage", sort=None),
          )
          .properties(title="Overall runtime by stage")
      )
  
imports: from typing import Dict, Sequence, List, Tuple, Text, Union
  from absl import app
  from absl import flags
  import altair
  import pandas
  import tensorflow
  from third_party.nucleus.io import sharded_file_utils
  from deepvariant import dashboard_utils
label_desc: Use image node_id 7 for calling a global function with example usage: totals_by_stage(d) and returns: alt