code: def _remove_appendix_numbering_and_rename_bib(lines):
      BEGIN_APPENDIX = "\\chapter{Appendix"
      BEGIN_BIB = "\\begin{sphinxthebibliography"
      END_APPENDIX = [
          "\\endappendix",
          "\\renewcommand\\bibname{References}",
      ]
  
      found_begin_appendix = False
      one_appendix = True
      for i, l in enumerate(lines):
          if l.startswith(BEGIN_APPENDIX):
              lines[i] = lines[i].replace(
                  "\\chapter{Appendix: ", "\\chapter{"
              )
              # Full: 22. Appendix: Math; 23. Appendix: Tools -> Appendix A. Math; Appendix B. Tools
              # Insert before the first BEGIN_APPENDIX only
              if found_begin_appendix:
                  one_appendix = False
              else:
                  appendix_i = i
                  found_begin_appendix = True
          elif l.startswith(BEGIN_BIB):
              bib_i = i
  
      for i, v in enumerate(END_APPENDIX):
          lines.insert(bib_i + i, v)
      if one_appendix:
          lines.insert(appendix_i, "\\oneappendix")
      else:
          lines.insert(appendix_i, "\\appendix")
  
file_path: d2l-en/static/post_latex/main.py
imports: import os
  import re
  import regex
  import sys
label_desc: Use image node_id 9 for calling a global function with example usage: _remove_appendix_numbering_and_rename_bib(lines) without return types