code: def build_seasonality_feature_df_from_detection_result(
      df,
      time_col,
      seasonality_changepoints,
      seasonality_components_df,
      include_original_block=True,
      include_components=None,
  ):
      """Builds seasonality feature df from detected seasonality change points.
  
      The function is an extension of ``build_seasonality_feature_df_with_changes``. It can generate
      a seasonality feature df with different change points for different components. These changepoints
      are passed through a dictionary, which can be the output of
      `~greykite.algo.changepoint.adalasso.changepoint_detector.ChangepointDetector.find_seasonality_changepoints`
  
      Parameters
      __________
      df : `pandas.DataFrame`
          The dataframe used to build seasonality feature df.
      time_col : `str`
          The name of the time column in ``df``.
      seasonality_changepoints : `dict`
          The seasonality change point dictionary. The keys are seasonality components, and the values
          are the corresponding change points given in lists.
          For example
  
              "weekly": [Timestamp('2020-01-01 00:00:00'), Timestamp('2021-04-05 00:00:00')]
              "yearly": [Timestamp('2020-08-06 00:00:00')]
  
      seasonality_components_df : `pandas.DataFrame`
          The seasonality components dataframe that is compatible with
          `~greykite.algo.changepoint.adalasso.changepoint_detector.ChangepointDetector.find_seasonality_changepoints`
          The values in "seas_names" must equal to the keys in ``seasonality_changepoints``.
      include_original_block : `bool`, default True
          Whether to include the original untruncated block of sin or cos columns for each component. If set to
          False, the original seasonality block for each component will be dropped.
      include_components : `list` [`str`] or None, default None
          The components to be included from the result. If None, all components will be included.
  
      Returns
      -------
      seasonality_feature_df : `pandas.DataFrame`
          The seasonality feature dataframe similar to the output of `build_seasonality_feature_df_with_changes``
          but possibly with different changepoints on different components.
      """
      seasonality_df = pd.DataFrame()
      for component in seasonality_changepoints.keys():
          if (
              include_components is None
              or component in include_components
          ):
              seasonality_df_cp = (
                  build_seasonality_feature_df_with_changes(
                      df=df,
                      time_col=time_col,
                      changepoints_dict={
                          "method": "custom",
                          "dates": seasonality_changepoints[component],
                      },
                      fs_components_df=seasonality_components_df[
                          seasonality_components_df["seas_names"]
                          == component
                      ],
                  )
              )
              if not include_original_block:
                  original_block_size = int(
                      2
                      * seasonality_components_df.loc[
                          seasonality_components_df["seas_names"]
                          == component,
                          "order",
                      ].values[0]
                  )
                  seasonality_df_cp = seasonality_df_cp.iloc[
                      :, original_block_size:
                  ]
              seasonality_df = pd.concat(
                  [seasonality_df, seasonality_df_cp], axis=1
              )
      extra_components = (
          [
              component
              for component in seasonality_changepoints
              if component not in include_components
          ]
          if include_components is not None
          else []
      )
      if extra_components:
          warnings.warn(
              f"The following seasonality components have detected seasonality changepoints"
              f" but these changepoints are not included in the model,"
              f" because the seasonality component is not included in the model. {extra_components}"
          )
      return seasonality_df
  
imports: import warnings
  from datetime import timedelta
  import numpy
  import pandas
  import plotly.graph_objects
  from pandas.plotting import register_matplotlib_converters
  from pandas.tseries.frequencies import to_offset
  from sklearn.linear_model import Lasso
  from sklearn.linear_model import LassoCV
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import RidgeCV
  from greykite.common.constants import CHANGEPOINT_COL_PREFIX
  from greykite.common.constants import TimeFeaturesEnum
  from greykite.common.features.timeseries_features import add_time_features_df
  from greykite.common.features.timeseries_features import build_time_features_df
  from greykite.common.features.timeseries_features import fourier_series_multi_fcn
  from greykite.common.features.timeseries_features import get_changepoint_dates_from_changepoints_dict
  from greykite.common.features.timeseries_features import get_changepoint_features
  from greykite.common.features.timeseries_features import get_changepoint_features_and_values_from_config
  from greykite.common.features.timeseries_features import get_default_origin_for_time_vars
  from greykite.common.python_utils import get_pattern_cols
  from greykite.common.python_utils import unique_elements_in_list
label_desc: Use image node_id 4 for calling a global function with example usage: build_seasonality_feature_df_from_detection_result(df, time_col, seasonality_changepoints, seasonality_components_df, include_original_block, include_components) and returns: seasonality_df