code: def render_ner_html(
      sentences: Union[List[Sentence], Sentence],
      title: str = "Flair",
      colors={
          "PER": "#F7FF53",
          "ORG": "#E8902E",
          "LOC": "#FF40A3",
          "MISC": "#4647EB",
          "O": "#ddd",
      },
      default_color: str = "#ddd",
      wrap_page=True,
      label_name="ner",
  ) -> str:
      """Create the html code to visualize some sentences.
  
      Args:
          sentences: single sentence or list of sentences to convert to HTML
          title: title of the HTML page
          colors: dict where keys are tags and values are color HTML codes
          default_color: color to use if colors parameter is missing a tag
          wrap_page: if True method returns result of processing sentences wrapped by &lt;html&gt; and &lt;body&gt; tags, otherwise - without these tags
          label_name: the label name to specify which labels of the sentence are visualized.
  
      Returns: HTML as a string
      """
      if isinstance(sentences, Sentence):
          sentences = [sentences]
      sentences_html = []
      for s in sentences:
          spans = split_to_spans(s, label_name=label_name)
          spans_html = []
          for fragment, tag in spans:
              escaped_fragment = html.escape(fragment).replace(
                  "\n", "<br/>"
              )
              if tag:
                  escaped_fragment = TAGGED_ENTITY.format(
                      entity=escaped_fragment,
                      label=tag,
                      color=colors.get(tag, default_color),
                  )
              spans_html.append(escaped_fragment)
          line = PARAGRAPH.format(sentence="".join(spans_html))
          sentences_html.append(line)
  
      final_text = "".join(sentences_html)
  
      if wrap_page:
          return HTML_PAGE.format(text=final_text, title=title)
      else:
          return final_text
  
imports: import html
  from typing import List, Union
  from flair.data import Sentence
label_desc: Use image node_id 2 for calling a global function with example usage: render_ner_html(sentences, title, colors, default_color, wrap_page, label_name) and returns: HTML_PAGE, final_text