code: def split_every(n: int, iterable: Iterable) -> Iterator:
      """Split iterable into groups of n.
  
      >>> list(split_every(4, range(10)))
      [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
  
      https://stackoverflow.com/a/22919323
      """
      iterator = iter(iterable)
      return takewhile(
          bool, (list(islice(iterator, n)) for _ in repeat(None))
      )
  
imports: from __future__ import annotations
  import logging
  import logging.handlers
  import signal
  from collections.abc import Iterable, Iterator
  from contextlib import suppress
  from enum import Enum, auto
  from itertools import islice, repeat, takewhile, zip_longest
  from multiprocessing import Pipe, Process
  from multiprocessing.connection import Connection, wait
  from typing import Callable
  from ocrmypdf import Executor, hookimpl
  from ocrmypdf._concurrent import NullProgressBar
  from ocrmypdf.exceptions import InputFileError
  from ocrmypdf.helpers import remove_all_log_handlers
label_desc: Use image node_id 1 for calling a global function with example usage: split_every(n, iterable) and returns: takewhile