def _IsBackslashEscapedQuote(string, quote_index):
  """Checks if the quote at the given index is backslash escaped."""
  num_preceding_backslashes = 0
  for char in reversed(string[:quote_index]):
    if char == '\\':
      num_preceding_backslashes += 1
    else:
      break
  return num_preceding_backslashes % 2 == 1