code: def optimize_pdf(
      input_pdf: Path,
      output_pdf: Path,
      context: PdfContext,
      executor: Executor,
      linearize: bool,
  ) -> tuple[Path, Sequence[str]]:
      """Optimize a PDF after image, OCR and metadata processing.
  
      If the input_pdf is a PDF/A, the plugin should modify input_pdf in a way
      that preserves the PDF/A status, or report to the user when this is not possible.
  
      If the implementation fails to produce a smaller file than the input file, it
      should return input_pdf instead.
  
      A plugin that implements a new optimizer may need to suppress the built-in
      optimizer by implementing an ``initialize`` hook.
  
      Arguments:
          input_pdf: The input PDF, which has OCR added.
          output_pdf: The requested filename of the output PDF which should be created
              by this optimization hook.
          context: The current context.
          executor: An initialized executor which may be used during optimization,
              to distribute optimization tasks.
          linearize: If True, OCRmyPDF requires ``optimize_pdf`` to return a linearized,
              also known as fast web view PDF.
  
      Returns:
          Path: If optimization is successful, the hook should return ``output_file``.
              If optimization does not produce a smaller file, the hook should return
              ``input_file``.
          Sequence[str]: Any comments that the plugin wishes to report to the user,
              especially reasons it was not able to further optimize the file. For
              example, the plugin could report that a required third party was not
              installed, so a specific optimization was not attempted.
  
      Note:
          This is a :ref:`firstresult hook<firstresult>`.
      """
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from argparse import ArgumentParser, Namespace
  from collections.abc import Sequence, Set
  from logging import Handler
  from pathlib import Path
  from typing import TYPE_CHECKING, NamedTuple
  import pluggy
  from ocrmypdf import Executor, PdfContext
  from ocrmypdf._progressbar import ProgressBar
  from ocrmypdf.helpers import Resolution
label_desc: Use image node_id 14 for calling a global function with example usage: optimize_pdf(input_pdf, output_pdf, context, executor, linearize) without return types