code: def _plot_metrics(
      feature,
      metrics,
      dates,
      df,
      last_n,
      skip_first_n,
      skip_last_n,
      tl_colors,
      style: str = "heatmap",
  ):
      # prune dates and values
      dates = _prune(dates, last_n, skip_first_n, skip_last_n)
  
      values = [
          _prune(df[metric], last_n, skip_first_n, skip_last_n)
          for metric in metrics
      ]
  
      if len(values) > 0:
          values = np.stack(values)
  
          if style == "heatmap":
              plot = plot_traffic_lights_overview(
                  feature, values, metrics=metrics, labels=dates
              )
          elif style == "alerts":
              plot = plot_traffic_lights_alerts_aggregate(
                  feature,
                  values,
                  metrics=metrics,
                  labels=dates,
                  tl_colors=tl_colors,
              )
          else:
              raise ValueError(
                  "style must be either 'heatmap' or 'alerts'"
              )
      else:
          plot = ""
  
      return {
          "name": "Overview",
          "type": "traffic_light",
          "description": "",
          "plot": plot,
          "full_width": True,
      }
  
file_path: popmon/popmon/visualization/traffic_light_section_generator.py
imports: from __future__ import annotations
  import numpy
  import pandas
  from tqdm import tqdm
  from popmon.base import Module
  from popmon.config import Report
  from popmon.utils import filter_metrics, short_date
  from popmon.visualization.utils import _prune, plot_traffic_lights_alerts_aggregate, plot_traffic_lights_overview
label_desc: Use image node_id 1 for calling a global function with example usage: _plot_metrics(feature, metrics, dates, df, last_n, skip_first_n, skip_last_n, tl_colors, style) and returns: dict