code: def adjust_dep_arrows(raw_html: str) -> str:
      """
      Default spaCy dependency visualizations have misaligned arrows. Fix arrows by aligning arrow ends and bodies
      to the word that they are directed to.
  
      @param raw_html: Dependency relation visualization generated HTML from displaCy
      @return: Edited HTML string with fixed arrow placements
      """
  
      HTML_ARROW_BEGINNING = '<g class="displacy-arrow">'
      HTML_ARROW_ENDING = "</g>"
      HTML_ARROW_ENDING_LEN = (
          6  # there are 2 newline chars after the arrow ending
      )
      arrows_start_idx = find_nth(
          haystack=raw_html, needle='<g class="displacy-arrow">', n=1
      )
      words_html, arrows_html = (
          raw_html[:arrows_start_idx],
          raw_html[arrows_start_idx:],
      )  # separate html for words and arrows
      final_html = words_html  # continually concatenate to this after processing each arrow
      arrow_number = (
          1  # which arrow we're currently editing (1-indexed)
      )
      start_idx, end_of_class_idx = (
          find_nth(
              haystack=arrows_html,
              needle=HTML_ARROW_BEGINNING,
              n=arrow_number,
          ),
          find_nth(
              haystack=arrows_html,
              needle=HTML_ARROW_ENDING,
              n=arrow_number,
          ),
      )
      while start_idx != -1:  # edit every arrow
          arrow_section = arrows_html[
              start_idx : end_of_class_idx + HTML_ARROW_ENDING_LEN
          ]  # slice a single svg arrow object
          if (
              arrow_section[-1] == "<"
          ):  # this is the last arrow in the HTML, don't cut the splice early
              arrow_section = arrows_html[start_idx:]
          edited_arrow_section = edit_dep_arrow(arrow_section)
  
          final_html = (
              final_html + edited_arrow_section
          )  # continually update html with new arrow html until done
  
          # Prepare for next iteration
          arrow_number += 1
          start_idx = find_nth(
              arrows_html, '<g class="displacy-arrow">', arrow_number
          )
          end_of_class_idx = find_nth(arrows_html, "</g>", arrow_number)
      return final_html
  
imports: import os
  import argparse
  import stanza
  import sys
  from stanza.server.semgrex import Semgrex
  from stanza.models.common.constant import is_right_to_left
  import spacy
  from spacy import displacy
  from spacy.tokens import Doc
  from IPython.display import display, HTML
  import typing
  from typing import List, Tuple, Any
  from utils import find_nth, round_base
label_desc: Use image node_id 6 for calling a global function with example usage: adjust_dep_arrows(raw_html) and returns: final_html