code: def check_validation_and_epoch_counts(
      lines: List[str], **kwargs: Dict
  ) -> None:
      """Ensure that validation_period and epoch indices increment by 1 each time."""
      counts = {"on_epoch": 0, "on_validation_period": 0}
      for i, line in enumerate(lines):
          cb = line.split(":")[0]
          for prefix in counts:
              if cb.startswith(prefix):
                  cb_idx = int(line.split(":")[1])
                  if cb.endswith("begin"):
                      "got on_validation_period_begin for index 0 but expected 0 on line {i}"
                      assert (
                          cb_idx == counts[prefix]
                      ), f"got {cb} for index {cb_idx} but expected {counts[prefix]} on line {i}"
                  if cb.endswith("end"):
                      assert (
                          cb_idx == counts[prefix]
                      ), f"got {cb} for index {cb_idx} but expected {counts[prefix]} on line {i}"
                      counts[prefix] += 1
  
imports: import io
  from typing import Any, Callable, Dict, List, Optional, Set
  import determined
  import determined.keras
label_desc: Use image node_id 9 for calling a global function with example usage: check_validation_and_epoch_counts(lines) without return types