code: def is_optimization_enabled(context: PdfContext) -> bool:
      """For a given PdfContext, OCRmyPDF asks the plugin if optimization is enabled.
  
      An optimization plugin might be installed and active but could be disabled by
      user settings.
  
      If this returns False, OCRmyPDF will take certain actions to finalize the PDF.
  
      Returns:
          True if the plugin's optimization is enabled.
  
      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 15 for calling a global function with example usage: is_optimization_enabled(context) without return types