code: def validate_volatility_features(
      volatility_features_list, valid_features=None
  ):
      """Removes duplicate values from ``volatility_features_list``
       and validates the features against ``valid_features``.
  
       Parameters
       ----------
       volatility_features_list: `list` [`list` [`str`]]
          Lists of volatility features used to optimize anomaly detection performance.
          Valid volatility feature column names are
          either columns of ``df`` or belong to
          `~greykite.common.constants.TimeFeaturesEnum`.
  
       valid_features: `list` [`str`] or None
          ``volatility_features_list`` is validated against this list.
  
      Returns
      -------
      validated_features_list: `list` [`list` [`str`]]
          List of validated volatility features.
      """
      # Removes duplicates
      validated_features_list = []
      for features in volatility_features_list:
          # Removes duplicates within a set of features
          features = list(dict.fromkeys(features))
          # Removes duplicates among the feature sets
          if features not in validated_features_list:
              validated_features_list.append(features)
  
      # Checks features against the provided features in ``valid_features``
      if valid_features is not None:
          all_features = sum(validated_features_list, [])
          unique_features = set(all_features)
          missing_features = unique_features - set(valid_features)
          if missing_features:
              raise ValueError(
                  f"Unknown feature(s) ({missing_features}) in `volatility_features_list`. "
                  f"Valid features are: [{valid_features}]."
              )
  
      return validated_features_list
  
file_path: greykite/greykite/detection/detector/ad_utils.py
imports: from functools import reduce
  import pandas
  from greykite.common.constants import ANOMALY_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.features.outlier import ZScoreOutlierDetector
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.detection.detector.constants import Z_SCORE_CUTOFF
label_desc: Use image node_id 7 for calling a global function with example usage: validate_volatility_features(volatility_features_list, valid_features) and returns: validated_features_list