code: def check_train_test_split(dataset):
      prediction_length = dataset.metadata.prediction_length
  
      train_end = {}
      for entry in dataset.train:
          assert (
              entry["item_id"] not in train_end
          ), f"item {entry['item_id']} is duplicate"
          train_end[entry["item_id"]] = forecast_start(entry)
  
      test_end = {}
      for entry in dataset.test:
          test_end[entry["item_id"]] = forecast_start(entry)
  
      for k in test_end:
          if k not in train_end:
              continue
          expected_end = (
              train_end[k] + prediction_length * train_end[k].freq
          )
          assert (
              test_end[k] >= expected_end
          ), f"test entry for item {k} ends at {test_end[k]} < {expected_end}"
  
imports: import pytest
  from gluonts.dataset.repository import dataset_names, get_dataset
  from gluonts.dataset.util import forecast_start
label_desc: Use image node_id 1 for calling a global function with example usage: check_train_test_split(dataset) without return types