code: def _remove_index(lines):
      for i, l in enumerate(lines):
          j_start = 0
          while j_start < len(l) - 6:
              if l[j_start : j_start + 7] == "\\index{":
                  j = j_start + 7
                  num_extra_left_braces = 1
                  while num_extra_left_braces > 0:
                      if l[j] == "{":
                          num_extra_left_braces += 1
                      elif l[j] == "}":
                          num_extra_left_braces -= 1
                      j += 1
                  enclosed_text = l[j_start + 7 : j - 1]
                  lines[i] = lines[i].replace(
                      "\\index{" + enclosed_text + "}", ""
                  )
                  j_start = j
              else:
                  j_start += 1
  
file_path: d2l-en/static/post_latex/main.py
imports: import os
  import re
  import regex
  import sys
label_desc: Use image node_id 13 for calling a global function with example usage: _remove_index(lines) without return types