code: def seasonality_model(
      F,
      num_coefficients: int,
      context_length: int,
      prediction_length: int,
      is_forecast: bool,
  ) -> Tensor:
      """
      Creates a fourier series basis with num_coefficients coefficients for sine
      and cosine each.
  
      So the total number of learned coefficients amounts to 2*num_coefficients.
      """
      t = linear_space(
          F, context_length, prediction_length, fwd_looking=is_forecast
      )
      cosines = F.stack(
          *[F.cos(2 * np.pi * i * t) for i in range(num_coefficients)]
      )
      sines = F.stack(
          *[F.sin(2 * np.pi * i * t) for i in range(num_coefficients)]
      )
      S = F.concat(cosines, sines, dim=0)
      return S
  
imports: from typing import List, Optional
  import mxnet
  import numpy
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from gluonts.mx.block.scaler import MeanScaler, NOPScaler
  from gluonts.time_feature import get_seasonality
label_desc: Use image node_id 2 for calling a global function with example usage: seasonality_model(F, num_coefficients, context_length, prediction_length, is_forecast) and returns: S