code: def remove_seasonality(
      ts: TimeSeries,
      freq: int = None,
      model: SeasonalityMode = SeasonalityMode.MULTIPLICATIVE,
      method: str = "naive",
      **kwargs,
  ) -> TimeSeries:
      """
      Adjusts the TimeSeries `ts` for a seasonality of order `frequency` using the `model` decomposition.
  
      Parameters
      ----------
      ts
          The TimeSeries to adjust.
      freq
          The seasonality period to use.
      model
          The type of decomposition to use.
          Must be a `from darts import SeasonalityMode` Enum member.
          Either SeasonalityMode.MULTIPLICATIVE or SeasonalityMode.ADDITIVE.
          Defaults SeasonalityMode.MULTIPLICATIVE.
      method
          The method to be used to decompose the series.
          - "naive" : Seasonal decomposition using moving averages [1]_.
          - "STL" : Season-Trend decomposition using LOESS [2]_. Only compatible with ``ADDITIVE`` model type.
          Defaults to "naive"
      kwargs
          Other keyword arguments are passed down to the decomposition method.
  
      Returns
      -------
      TimeSeries
          A new TimeSeries instance that corresponds to the seasonality-adjusted 'ts'.
  
      References
      -------
      .. [1] https://www.statsmodels.org/devel/generated/statsmodels.tsa.seasonal.seasonal_decompose.html
      .. [2] https://www.statsmodels.org/devel/generated/statsmodels.tsa.seasonal.STL.html
      """
      ts._assert_univariate()
      raise_if_not(
          model is not SeasonalityMode.NONE,
          "The model must be either MULTIPLICATIVE or ADDITIVE.",
      )
      raise_if(
          model not in [SeasonalityMode.ADDITIVE, ModelMode.ADDITIVE]
          and method == "STL",
          f"Only ADDITIVE seasonality is compatible with the STL method. Current model is {model}.",
          logger,
      )
  
      _, seasonality = extract_trend_and_seasonality(
          ts, freq, model, method, **kwargs
      )
      new_ts = remove_from_series(ts, seasonality, model)
      return new_ts
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from scipy.signal import argrelmax
  from scipy.stats import norm
  from statsmodels.tsa.seasonal import MSTL, STL, seasonal_decompose
  from statsmodels.tsa.stattools import acf, adfuller, grangercausalitytests, kpss, pacf
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from .missing_values import fill_missing_values
  from .utils import ModelMode, SeasonalityMode
label_desc: Use image node_id 5 for calling a global function with example usage: remove_seasonality(ts, freq, model, method) and returns: new_ts