code: def generate_artificial_dataset(
      dataset_path: Path,
      dataset: ArtificialDataset,
      dataset_writer: DatasetWriter,
      prediction_length: Optional[int] = None,
  ) -> None:
      ds = dataset.generate()
      assert ds.test is not None
      if prediction_length is not None:
          ds.metadata.prediction_length = prediction_length
  
      dataset = TrainDatasets(
          metadata=ds.metadata, train=ds.train, test=ds.test
      )
      dataset.save(
          path_str=str(dataset_path),
          writer=dataset_writer,
          overwrite=True,
      )
  
imports: from pathlib import Path
  from typing import Optional
  from gluonts.dataset import DatasetWriter
  from gluonts.dataset.artificial import ArtificialDataset
  from gluonts.dataset.common import TrainDatasets
label_desc: Use image node_id 1 for calling a global function with example usage: generate_artificial_dataset(dataset_path, dataset, dataset_writer, prediction_length) without return types