def _escape_md(string):
  """Escapes special markdown characters in a string."""
  last_start = 0
  chunks = []
  for match in RE_MARKDOWN_SPECIAL_CHARS.finditer(string):
    chunks.append(string[last_start:match.start()])
    last_start = match.start()
  chunks.append(string[last_start:])
  return "\\".join(chunks)
Escapes special markdown characters in a string.
language/fruit/metrics.py