code: def thetaupdate(
      states, i, modeltype, alpha, theta, y, usemu
  ):  # kind of model
      # states
      # level, meany, An, Bn, mu
      # get params
      level = states[i - 1, 0]
      meany = states[i - 1, 1]
      An = states[i - 1, 2]
      Bn = states[i - 1, 3]
      # update mu
      states[i, 4] = level + (1 - 1 / theta) * (
          An * ((1 - alpha) ** i)
          + Bn * (1 - (1 - alpha) ** (i + 1)) / alpha
      )
      if usemu:
          y = states[i, 4]
      # update level
      states[i, 0] = alpha * y + (1 - alpha) * level
      # update meany
      states[i, 1] = (i * meany + y) / (i + 1)
      # update Bn and An
      if modeltype in [DSTM, DOTM]:
          # dynamic models
          states[i, 3] = ((i - 1) * Bn + 6 * (y - meany) / (i + 1)) / (
              i + 2
          )
          states[i, 2] = states[i, 1] - states[i, 3] * (i + 2) / 2
      else:
          states[i, 2] = An
          states[i, 3] = Bn
  
imports: import math
  from typing import Tuple
  import numpy
  from numba import njit
  from scipy.stats import norm
  from statsmodels.tsa.seasonal import seasonal_decompose
  from statsmodels.tsa.stattools import acf
  from .ets import restrict_to_bounds, results
  from .utils import _seasonal_naive, _repeat_val_seas, CACHE, NOGIL
label_desc: Use image node_id 4 for calling a global function with example usage: thetaupdate(states, i, modeltype, alpha, theta, y, usemu) without return types