code: def xhtml_escape(value: Union[str, bytes]) -> str:
      """Escapes a string so it is valid within HTML or XML.
  
      Escapes the characters ``<``, ``>``, ``"``, ``'``, and ``&``.
      When used in attribute values the escaped strings must be enclosed
      in quotes.
  
      Equivalent to `html.escape` except that this function always returns
      type `str` while `html.escape` returns `bytes` if its input is `bytes`.
  
      .. versionchanged:: 3.2
  
         Added the single quote to the list of escaped characters.
  
      .. versionchanged:: 6.4
  
         Now simply wraps `html.escape`. This is equivalent to the old behavior
         except that single quotes are now escaped as ``&#x27;`` instead of
         ``&#39;`` and performance may be different.
      """
      return html.escape(to_unicode(value))
  
imports: import html
  import json
  import re
  import urllib.parse
  from tornado.util import unicode_type
  import typing
  from typing import Union, Any, Optional, Dict, List, Callable
label_desc: Use image node_id 1 for calling a global function with example usage: xhtml_escape(value) and returns: html