code: def build_seasonal_transition_matrix(
      num_seasons,
      is_last_day_of_season,
      dtype,
      basis_change_matrix=None,
      basis_change_matrix_inv=None,
  ):
      """Build a function computing transitions for a seasonal effect model."""
  
      with tf.name_scope("build_seasonal_transition_matrix"):
          # If the season is changing, the transition matrix permutes the latent
          # state to shift all seasons up by a dimension, and sends the current
          # season's effect to the bottom.
          seasonal_permutation = np.concatenate(
              [np.arange(1, num_seasons), [0]], axis=0
          )
          seasonal_permutation_matrix = tf.constant(
              np.eye(num_seasons)[seasonal_permutation], dtype=dtype
          )
  
          # Optionally transform the transition matrix into a reparameterized space,
          # enforcing the zero-sum constraint for ConstrainedSeasonalStateSpaceModel.
          if basis_change_matrix is not None:
              seasonal_permutation_matrix = tf.matmul(
                  basis_change_matrix,
                  tf.matmul(
                      seasonal_permutation_matrix,
                      basis_change_matrix_inv,
                  ),
              )
  
          identity_matrix = tf.eye(
              ps.shape(seasonal_permutation_matrix)[-1], dtype=dtype
          )
  
          def seasonal_transition_matrix(t):
              return tf.linalg.LinearOperatorFullMatrix(
                  matrix=dist_util.pick_scalar_condition(
                      is_last_day_of_season(t),
                      seasonal_permutation_matrix,
                      identity_matrix,
                  )
              )
  
      return seasonal_transition_matrix
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import softplus
  from tensorflow_probability.python.bijectors import square
  from tensorflow_probability.python.distributions import inverse_gamma
  from tensorflow_probability.python.distributions import linear_gaussian_ssm
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.experimental.sts_gibbs import sample_parameters
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import docstring_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.sts.internal import util
  from tensorflow_probability.python.sts.structural_time_series import Parameter
  from tensorflow_probability.python.sts.structural_time_series import StructuralTimeSeries
label_desc: Use image node_id 3 for calling a global function with example usage: build_seasonal_transition_matrix(num_seasons, is_last_day_of_season, dtype, basis_change_matrix, basis_change_matrix_inv) and returns: seasonal_transition_matrix, tf