         if "&" in text:             text = text.replace("&", "&amp;")         if "<" in text:             text = text.replace("<", "&lt;")         if ">" in text:             text = text.replace(">", "&gt;")         return text     except (TypeError, AttributeError):  # pragma: no cover         _raise_serialization_error(text)   def _escape_attrib(text):     # escape attribute value     try:         if "&" in text:             text = text.replace("&", "&amp;")         if "<" in text:             text = text.replace("<", "&lt;")         if ">" in text:             text = text.replace(">", "&gt;")         if "\"" in text:             text = text.replace("\"", "&quot;")         