def _escape_tex_reserved_symbols(input):
 def replace(match):
  return TEX_RESERVED_SYMBOLS_MAP[match.group()]
 return TEX_RESERVED_SYMBOLS_RE.sub(replace, input)

def _escape_tex_reserved_symbols ( input ) : def replace ( match ) : return TEX_RESERVED_SYMBOLS_MAP [ match . group ( ) ] return TEX_RESERVED_SYMBOLS_RE . sub ( replace , input )
escapes all tex reserved symbols in a string .