code: def get_changepoint_features_and_values_from_config(
      df, time_col, changepoints_dict=None, origin_for_time_vars=None
  ):
      """Extracts changepoints from changepoint configuration and input data
  
      :param df: pd.DataFrame
          Training data. A data frame which includes the timestamp and value columns
      :param time_col: str
          The column name in `df` representing time for the time series data
          The time column can be anything that can be parsed by pandas DatetimeIndex
      :param changepoints_dict: Optional[Dict[str, any]]
          Specifies the changepoint configuration.
          "method": str
              The method to locate changepoints. Valid options:
                  "uniform". Places n_changepoints evenly spaced changepoints to allow growth to change.
                  "custom". Places changepoints at the specified dates.
              Additional keys to provide parameters for each particular method are described below.
          "continuous_time_col": Optional[str]
              Column to apply `growth_func` to, to generate changepoint features
              Typically, this should match the growth term in the model
          "growth_func": Optional[func]
              Growth function (scalar -> scalar). Changepoint features are created
              by applying `growth_func` to "continuous_time_col" with offsets.
              If None, uses identity function to use `continuous_time_col` directly
              as growth term
          If changepoints_dict["method"] == "uniform", this other key is required:
              "n_changepoints": int
                  number of changepoints to evenly space across training period
          If changepoints_dict["method"] == "custom", this other key is required:
              "dates": Iterable[Union[int, float, str, datetime]]
                  Changepoint dates. Must be parsable by pd.to_datetime.
                  Changepoints are set at the closest time on or after these dates
                  in the dataset.
      :param origin_for_time_vars: Optional[float]
          The time origin used to create continuous variables for time
      :return: Dict[str, any]
          Dictionary with the requested changepoints and associated information
          changepoint_df: pd.DataFrame, shape (df.shape[0], len(changepoints))
              Changepoint features for modeling the training data
          changepoint_values: array-like
              List of changepoint values (on same scale as df[continuous_time_col])
              Can be used to generate changepoints for prediction.
          continuous_time_col: Optional[str]
              Name of continuous time column in df
              growth_func is applied to this column to generate growth term.
              If None, uses "ct1", linear growth
              Can be used to generate changepoints for prediction.
          growth_func: Optional[callable]
              Growth function for defining changepoints (scalar -> scalar).
              If None, uses identity function to use continuous_time_col directly
              as growth term.
              Can be used to generate changepoints for prediction.
          changepoint_cols: List[str]
              Names of the changepoint columns for modeling
      """
      # extracts changepoint values
      if changepoints_dict is None:
          changepoint_values = None
          continuous_time_col = None
          growth_func = None
      else:
          if origin_for_time_vars is None:
              origin_for_time_vars = get_default_origin_for_time_vars(
                  df, time_col
              )
          time_features_df = build_time_features_df(
              df[time_col], conti_year_origin=origin_for_time_vars
          )
  
          changepoint_values = get_changepoint_values_from_config(
              changepoints_dict=changepoints_dict,
              time_features_df=time_features_df,
              time_col="datetime",
          )  # datetime column generated by `build_time_features_df`
          continuous_time_col = changepoints_dict.get(
              "continuous_time_col"
          )
          growth_func = changepoints_dict.get("growth_func")
  
      # extracts changepoint column names
      if changepoint_values is None:
          changepoint_df = None
          changepoint_cols = []
      else:
          if changepoints_dict is None:
              changepoint_dates = None
          elif changepoints_dict["method"] == "custom":
              changepoint_dates = list(
                  pd.to_datetime(changepoints_dict["dates"])
              )
          elif changepoints_dict["method"] == "uniform":
              changepoint_dates = get_evenly_spaced_changepoints_dates(
                  df=df,
                  time_col=time_col,
                  n_changepoints=changepoints_dict["n_changepoints"],
              ).tolist()[
                  1:
              ]  # the changepoint features does not include the growth term
          else:
              changepoint_dates = None
          changepoint_df = get_changepoint_features(
              df=time_features_df,
              changepoint_values=changepoint_values,
              continuous_time_col=continuous_time_col,
              growth_func=growth_func,
              changepoint_dates=changepoint_dates,
          )
          changepoint_cols = list(changepoint_df.columns)
  
      return {
          "changepoint_df": changepoint_df,
          "changepoint_values": changepoint_values,
          "continuous_time_col": continuous_time_col,
          "growth_func": growth_func,
          "changepoint_cols": changepoint_cols,
      }
  
imports: import math
  from datetime import datetime
  from datetime import timedelta
  import numpy
  import pandas
  import pytz
  from holidays_ext import get_holidays
  from pandas.tseries.frequencies import to_offset
  from scipy.special import expit
  from greykite.common import constants
  from greykite.common.python_utils import split_offset_str
label_desc: Use image node_id 23 for calling a global function with example usage: get_changepoint_features_and_values_from_config(df, time_col, changepoints_dict, origin_for_time_vars) and returns: dict