code: def generate_pdfa_ps(target_filename: Path, icc: str = "sRGB"):
      """Create a Postscript PDFMARK file for Ghostscript PDF/A conversion.
  
      pdfmark is an extension to the Postscript language that describes some PDF
      features like bookmarks and annotations. It was originally specified Adobe
      Distiller, for Postscript to PDF conversion.
  
      Ghostscript uses pdfmark for PDF to PDF/A conversion as well. To use Ghostscript
      to create a PDF/A, we need to create a pdfmark file with the necessary metadata.
  
      This function takes care of the many version-specific bugs and peculiarities in
      Ghostscript's handling of pdfmark.
  
      The only information we put in specifies that we want the file to be a
      PDF/A, and we want to Ghostscript to convert objects to the sRGB colorspace
      if it runs into any object that it decides must be converted.
  
      Arguments:
          target_filename: filename to save
          icc: ICC identifier such as 'sRGB'
      References:
          Adobe PDFMARK Reference:
          https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdfmark_reference.pdf
      """
      if icc != "sRGB":
          raise NotImplementedError("Only supporting sRGB")
  
      bytes_icc_profile = (
          package_files("ocrmypdf.data") / SRGB_ICC_PROFILE_NAME
      ).read_bytes()
      postscript = "\n".join(
          _make_postscript(icc, bytes_icc_profile, 3)
      )
  
      # We should have encoded everything to pure ASCII by this point, and
      # to be safe, only allow ASCII in PostScript
      Path(target_filename).write_text(postscript, encoding="ascii")
      return target_filename
  
file_path: OCRmyPDF/src/ocrmypdf/pdfa.py
imports: from __future__ import annotations
  import base64
  from collections.abc import Iterator
  from importlib.resources import files
  from pathlib import Path
  import pikepdf
label_desc: Use image node_id 3 for calling a global function with example usage: generate_pdfa_ps(target_filename, icc) and returns: target_filename