code: def initstate(y, m, seasontype):
      n = len(y)
      components = 2 + (seasontype == "P") + 2 * (seasontype == "F")
      lags = 1 if seasontype == "N" else m
      states = np.zeros((lags, components), dtype=np.float32)
      if seasontype == "N":
          idx = min(max(10, m), n)
          mean_ = np.mean(y[:idx])
          states[0, 0] = mean_
          states[0, 1] = mean_ / 1.1
      elif seasontype == "S":
          states[:lags, 0] = y[:lags]
          states[:lags, 1] = y[:lags] / 1.1
      elif seasontype == "P":
          states[:lags, 0] = np.mean(y[:lags])
          states[:lags, 1] = states[:lags, 0] / 1.1
          states[:lags, 2] = seasonal_decompose(
              y, period=lags
          ).seasonal[:lags]
      elif seasontype == "F":
          states[:lags, 0] = np.mean(y[:lags])
          states[:lags, 1] = states[:lags, 0] / 1.1
          states[:lags, 2] = seasonal_decompose(
              y, period=lags
          ).seasonal[:lags]
          states[:lags, 3] = states[:lags, 2] / 1.1
      else:
          raise Exception(f"Unkwon seasontype: {seasontype}")
  
      return states
  
imports: import math
  from typing import Tuple
  import numpy
  from numba import njit
  from statsmodels.tsa.seasonal import seasonal_decompose
  from .ets import restrict_to_bounds, results
  from .utils import CACHE, NOGIL
label_desc: Use image node_id 1 for calling a global function with example usage: initstate(y, m, seasontype) and returns: states