code: def escape_tex(text, commandprefix):
      return (
          text.replace("\\", "\x00")
          .replace("{", "\x01")
          .replace("}", "\x02")
          .replace("\x00", r"\%sZbs{}" % commandprefix)
          .replace("\x01", r"\%sZob{}" % commandprefix)
          .replace("\x02", r"\%sZcb{}" % commandprefix)
          .replace("^", r"\%sZca{}" % commandprefix)
          .replace("_", r"\%sZus{}" % commandprefix)
          .replace("&", r"\%sZam{}" % commandprefix)
          .replace("<", r"\%sZlt{}" % commandprefix)
          .replace(">", r"\%sZgt{}" % commandprefix)
          .replace("#", r"\%sZsh{}" % commandprefix)
          .replace("%", r"\%sZpc{}" % commandprefix)
          .replace("$", r"\%sZdl{}" % commandprefix)
          .replace("-", r"\%sZhy{}" % commandprefix)
          .replace("'", r"\%sZsq{}" % commandprefix)
          .replace('"', r"\%sZdq{}" % commandprefix)
          .replace("~", r"\%sZti{}" % commandprefix)
      )
  
file_path: catboost/contrib/python/Pygments/py2/pygments/formatters/latex.py
imports: from __future__ import division
  from pygments.formatter import Formatter
  from pygments.lexer import Lexer
  from pygments.token import Token, STANDARD_TYPES
  from pygments.util import get_bool_opt, get_int_opt, StringIO, xrange, iteritems
label_desc: Use image node_id 1 for calling a global function with example usage: escape_tex(text, commandprefix) and returns: text