code: def calculate_totals(df: pd.DataFrame) -> pd.DataFrame:
      """Calculates total runtime, formats it nicely, and sorts by it.
  
      Args:
        df: A dataframe of runtime profiling numbers.
  
      Returns:
        The same dataframe with some additional summary columns.
      """
      # 'total runtime' is a simple sum of the runtime columns.
      df["total runtime"] = df[RUNTIME_COLUMNS].sum(axis=1)
  
      # Create a formatted runtime string for tooltips.
      df["Runtime"] = df["total runtime"].apply(format_runtime_string)
  
      # Sort by descending total region runtime.
      df.sort_values(by="total runtime", inplace=True, ascending=False)
  
      return df
  
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 3 for calling a global function with example usage: calculate_totals(df) and returns: df