code: def split(
      dataset: Dataset,
      *,
      offset: Optional[int] = None,
      date: pd.Period = None,
  ) -> Tuple[TrainingDataset, TestTemplate]:
      assert (offset is None) != (
          date is None
      ), "You need to provide ``offset`` or ``date``, but not both."
      if offset is not None:
          return OffsetSplitter(offset).split(dataset)
      else:
          return DateSplitter(date).split(dataset)
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Generator, Optional, Tuple
  import pandas
  from gluonts.dataset import Dataset, DataEntry
  from gluonts.dataset.field_names import FieldName
label_desc: Use image node_id 5 for calling a global function with example usage: split(dataset) and returns: OffsetSplitter, DateSplitter