code: def hlescape(s: str, latex_engine: str | None = None) -> str:
      """Escape text for LaTeX highlighter."""
      if latex_engine in ("lualatex", "xelatex"):
          # unicode based LaTeX engine
          return s.translate(_tex_hlescape_map_without_unicode)
      else:
          return s.translate(_tex_hlescape_map)
  
imports: from __future__ import annotations
  import re
label_desc: Use image node_id 2 for calling a global function with example usage: hlescape(s, latex_engine) and returns: s, s