code: def check_options(options):
      if options.optimize >= 2:
          check_external_program(
              program="pngquant",
              package="pngquant",
              version_checker=pngquant.version,
              need_version="2.12.2",
              required_for="--optimize {2,3}",
          )
  
      if options.optimize >= 2:
          # Although we use JBIG2 for optimize=1, don't nag about it unless the
          # user is asking for more optimization
          check_external_program(
              program="jbig2",
              package="jbig2enc",
              version_checker=jbig2enc.version,
              need_version="0.28",
              required_for="--optimize {2,3} | --jbig2-lossy",
              recommended=True if not options.jbig2_lossy else False,
          )
  
      if options.optimize == 0 and any(
          [
              options.jbig2_lossy,
              options.png_quality,
              options.jpeg_quality,
          ]
      ):
          log.warning(
              "The arguments --jbig2-lossy, --png-quality, and --jpeg-quality "
              "will be ignored because --optimize=0."
          )
  
file_path: OCRmyPDF/src/ocrmypdf/builtin_plugins/optimize.py
imports: from __future__ import annotations
  import argparse
  import logging
  from collections.abc import Sequence
  from pathlib import Path
  from ocrmypdf import Executor, PdfContext, hookimpl
  from ocrmypdf._exec import jbig2enc, pngquant
  from ocrmypdf._pipeline import get_pdf_save_settings
  from ocrmypdf.cli import numeric
  from ocrmypdf.optimize import optimize
  from ocrmypdf.subprocess import check_external_program
label_desc: Use image node_id 2 for calling a global function with example usage: check_options(options) without return types