code: def simulate_seasonal_term(
      periodicity, total_cycles, noise_std=1.0, harmonics=None
  ):
      duration = periodicity * total_cycles
      assert duration == int(duration)
      duration = int(duration)
      harmonics = (
          harmonics if harmonics else int(np.floor(periodicity / 2))
      )
  
      lambda_p = 2 * np.pi / float(periodicity)
  
      gamma_jt = noise_std * np.random.randn(harmonics)
      gamma_star_jt = noise_std * np.random.randn(harmonics)
  
      total_timesteps = 100 * duration  # Pad for burn in
      series = np.zeros(total_timesteps)
      for t in range(total_timesteps):
          gamma_jtp1 = np.zeros_like(gamma_jt)
          gamma_star_jtp1 = np.zeros_like(gamma_star_jt)
          for j in range(1, harmonics + 1):
              cos_j = np.cos(lambda_p * j)
              sin_j = np.sin(lambda_p * j)
              gamma_jtp1[j - 1] = (
                  gamma_jt[j - 1] * cos_j
                  + gamma_star_jt[j - 1] * sin_j
                  + noise_std * np.random.randn()
              )
              gamma_star_jtp1[j - 1] = (
                  -gamma_jt[j - 1] * sin_j
                  + gamma_star_jt[j - 1] * cos_j
                  + noise_std * np.random.randn()
              )
          series[t] = np.sum(gamma_jtp1)
          gamma_jt = gamma_jtp1
          gamma_star_jt = gamma_star_jtp1
      wanted_series = series[-duration:]  # Discard burn in
  
      return wanted_series
  
imports: import numpy
  import pandas
  import statsmodels.api
  import matplotlib.pyplot
label_desc: Use image node_id 1 for calling a global function with example usage: simulate_seasonal_term(periodicity, total_cycles, noise_std, harmonics) and returns: wanted_series