code: def extract_subseries(
      series: TimeSeries,
      min_gap_size: Optional[int] = 1,
      mode: str = "all",
  ) -> List[TimeSeries]:
      """
      Partitions the series into a sequence of sub-series by using significant gaps of missing values
  
      Parameters
      ----------
      series
          The TimeSeries to partition into sub-series
  
      min_gap_size
          The minimum number of contiguous missing values to consider a gap as significant. Defaults to 1.
  
      mode
          Only for multivariate TimeSeries. The definition of a gap; presence of a NaN in any column ("any")
          or NaNs in all the columns ("all") for a given timestamp. Defaults to "all".
  
      Returns
      -------
      subseries
          A list of TimeSeries, sub-series without significant gaps of missing values
  
      See Also
      --------
      TimeSeries.gaps : return the gaps in the TimeSeries
      """
  
      # Remove null values from the series extremes
      series = series.strip()
      freq = series.freq
  
      if series.pd_dataframe().isna().sum().sum() == 0:
          return [series]
  
      # Get start/end times of sub-series without gaps of missing values
      gaps_df = series.gaps(mode=mode)
      if gaps_df.empty:
          return series
      else:
          gaps_df = gaps_df.query(f"gap_size>={min_gap_size}")
          start_times = [series.start_time()] + (
              gaps_df["gap_end"] + freq
          ).to_list()
          end_times = (gaps_df["gap_start"] - freq).to_list() + [
              series.end_time() + freq
          ]
  
          subseries = []
          for start, end in zip(start_times, end_times):
              subseries.append(series[start:end])
  
          return subseries
  
imports: from typing import List, Optional, Union
  from darts.logging import get_logger, raise_if, raise_if_not
  from darts.timeseries import TimeSeries
label_desc: Use image node_id 3 for calling a global function with example usage: extract_subseries(series, min_gap_size, mode) and returns: list, series, subseries