code: def check_pdf_pages_consistency(pdf):
      pages_info = pdf.read_indirect(pdf.pages_ref)
      assert b"Parent" not in pages_info
      assert b"Kids" in pages_info
      kids_not_used = pages_info[b"Kids"]
      for page_ref in pdf.pages:
          while True:
              if page_ref in kids_not_used:
                  kids_not_used.remove(page_ref)
              page_info = pdf.read_indirect(page_ref)
              assert b"Parent" in page_info
              page_ref = page_info[b"Parent"]
              if page_ref == pdf.pages_ref:
                  break
          assert pdf.pages_ref == page_info[b"Parent"]
      assert kids_not_used == []
  
imports: from __future__ import annotations
  import io
  import os
  import os.path
  import tempfile
  import time
  import pytest
  from PIL import Image, PdfParser, features
  from .helper import hopper, mark_if_feature_version, skip_unless_feature
label_desc: Use image node_id 13 for calling a global function with example usage: check_pdf_pages_consistency(pdf) without return types