code: def collect_traffic_light_bounds(monitoring_rules):
      """Collect traffic light boundaries
  
      Splits generic metrics and metrics which belong to particular features
      and puts them in separate objects.
  
      :param dict monitoring_rules: dictionary of defined monitoring rules (bounds)
  
      :return: dict metrics_per_feature (containing features with corresponding metrics),
               list metrics: list of generic metrics
      """
      metrics_per_feature = defaultdict(list)
      metrics = []
      for pattern in monitoring_rules:
          psplit = pattern.split(":")
          feature = ":".join(psplit[:-1])
          metric = psplit[-1]
          (metrics_per_feature[feature] if feature else metrics).append(
              metric
          )
  
      return metrics_per_feature, metrics
  
imports: from __future__ import annotations
  import copy
  import fnmatch
  from collections import defaultdict
  from typing import Any
  import numpy
  import pandas
  from popmon.analysis.apply_func import ApplyFunc
  from popmon.base import Module, Pipeline
label_desc: Use image node_id 3 for calling a global function with example usage: collect_traffic_light_bounds(monitoring_rules) and returns: metrics_per_feature,  metrics