code: def unescape_html(text):
      """
      Decode HTML entities and character references, including some nonstandard
      ones written in all-caps.
  
      Python has a built-in called `html.unescape` that can decode HTML escapes,
      including a bunch of messy edge cases such as decoding escapes without
      semicolons such as "&amp".
  
      If you know you've got HTML-escaped text, applying `html.unescape` is the
      right way to convert it to plain text. But in ambiguous situations, that
      would create false positives. For example, the informally written text
      "this&not that" should not automatically be decoded as "this¬ that".
  
      In this function, we decode the escape sequences that appear in the
      `html.entities.html5` dictionary, as long as they are the unambiguous ones
      that end in semicolons.
  
      We also decode all-caps versions of Latin letters and common symbols.
      If a database contains the name 'P&EACUTE;REZ', we can read that and intuit
      that it was supposed to say 'PÉREZ'. This is limited to a smaller set of
      entities, because there are many instances where entity names are
      case-sensitive in complicated ways.
  
          >>> unescape_html('&lt;tag&gt;')
          '<tag>'
  
          >>> unescape_html('&Jscr;ohn &HilbertSpace;ancock')
          '𝒥ohn ℋancock'
  
          >>> unescape_html('&checkmark;')
          '✓'
  
          >>> unescape_html('P&eacute;rez')
          'Pérez'
  
          >>> unescape_html('P&EACUTE;REZ')
          'PÉREZ'
  
          >>> unescape_html('BUNDESSTRA&SZLIG;E')
          'BUNDESSTRASSE'
  
          >>> unescape_html('&ntilde; &Ntilde; &NTILDE; &nTILDE;')
          'ñ Ñ Ñ &nTILDE;'
      """
      return HTML_ENTITY_RE.sub(_unescape_fixup, text)
  
imports: import codecs
  import html
  import re
  import warnings
  import ftfy
  from ftfy.chardata import ALTERED_UTF8_RE, C1_CONTROL_RE, CONTROL_CHARS, DOUBLE_QUOTE_RE, HTML_ENTITIES, HTML_ENTITY_RE, LIGATURES, LOSSY_UTF8_RE, SINGLE_QUOTE_RE, UTF8_DETECTOR_RE, WIDTH_MAP
  from ftfy.badness import is_bad
label_desc: Use image node_id 5 for calling a global function with example usage: unescape_html(text) and returns: HTML_ENTITY_RE