code: def fourier_series_fcn(col_name, period=1.0, order=1, seas_name=None):
      """Generates a function which creates fourier series matrix for a column of an input df
      :param col_name: str
          is the column name in the dataframe which is to be used for
          generating fourier series. It needs to be a continuous variable.
      :param period: float
          the period of the fourier series
      :param order: int
          the order of the fourier series
      :param seas_name: Optional[str]
          appended to new column names added for fourier terms.
          Useful to distinguish multiple fourier
          series on same col_name with different periods.
      :return: callable
          a function which can be applied to any data.frame df
          with a column name being equal to col_name
      """
  
      def fs_func(df):
          out_df_list = []
          out_cols = []
  
          if col_name not in df.columns:
              raise ValueError(
                  "The data frame does not have the column: " + col_name
              )
          x = df[col_name]
          x = np.array(x)
  
          for i in range(order):
              k = i + 1
              sin_col_name = get_fourier_col_name(
                  k, col_name, function_name="sin", seas_name=seas_name
              )
              cos_col_name = get_fourier_col_name(
                  k, col_name, function_name="cos", seas_name=seas_name
              )
              out_cols.append(sin_col_name)
              out_cols.append(cos_col_name)
              omega = 2 * math.pi / period
              u = omega * k * x
              out_df_list.append(
                  pd.Series(data=np.sin(u), name=sin_col_name)
              )
              out_df_list.append(
                  pd.Series(data=np.cos(u), name=cos_col_name)
              )
          if len(out_df_list) > 0:
              out_df = pd.concat(
                  objs=out_df_list, axis=1, ignore_index=False
              )
          else:
              out_df = pd.DataFrame()
          return {"df": out_df, "cols": out_cols}
  
      return fs_func
  
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 27 for calling a global function with example usage: fourier_series_fcn(col_name, period, order, seas_name) and returns: fs_func, dict