code: def check_if_configured(
      m, components, error_flag=False
  ):  # move to utils
      """Check if components were set in the model configuration by the user.
  
      Parameters
      ----------
          m : NeuralProphet
              Fitted NeuralProphet model
          components : str or list, optional
              name or list of names of components to check
  
              Options
              ----
              * ``trend``
              * ``trend_rate_change``
              * ``seasonality``
              * ``autoregression``
              * ``lagged_regressors```
              * ``events``
              * ``future_regressors`
              * ``uncertainty``
          error_flag : bool
              Activate to raise a ValueError if component has not been configured
  
      Returns
      -------
          components
              list of components only including the components set in the model configuration
      """
      invalid_components = []
      if (
          "trend_rate_change" in components
          and m.model.config_trend.changepoints is None
      ):
          components.remove("trend_rate_change")
          invalid_components.append("trend_rate_change")
      if "seasonality" in components and m.config_seasonality is None:
          components.remove("seasonality")
          invalid_components.append("seasonality")
      if "autoregression" in components and not m.config_ar.n_lags > 0:
          components.remove("autoregression")
          invalid_components.append("autoregression")
      if (
          "lagged_regressors" in components
          and m.config_lagged_regressors is None
      ):
          components.remove("lagged_regressors")
          invalid_components.append("lagged_regressors")
      if "events" in components and (
          m.config_events is None and m.config_country_holidays is None
      ):
          components.remove("events")
          invalid_components.append("events")
      if (
          "future_regressors" in components
          and m.config_regressors is None
      ):
          components.remove("future_regressors")
          invalid_components.append("future_regressors")
      if "uncertainty" in components and not len(m.model.quantiles) > 1:
          components.remove("uncertainty")
          invalid_components.append("uncertainty")
      if error_flag and len(invalid_components) != 0:
          raise ValueError(
              f" Selected component(s) {(invalid_components)} for plotting not specified in the model configuration."
          )
      return components
  
file_path: neural_prophet/neuralprophet/plot_utils.py
imports: import logging
  import warnings
  from collections import OrderedDict
  from typing import Optional
  import numpy
  import torch
  from neuralprophet import time_dataset, utils_torch
label_desc: Use image node_id 7 for calling a global function with example usage: check_if_configured(m, components, error_flag) and returns: components