@staticmethod<EOL><INDENT>def to_string(xml, **kwargs):<DEDENT>
if isinstance(xml, OneLogin_Saml2_XML._text_class):<EOL><INDENT>return xml<EOL><DEDENT>if isinstance(xml, OneLogin_Saml2_XML._element_class):<EOL><INDENT>OneLogin_Saml2_XML.cleanup_namespaces(xml)<EOL>return OneLogin_Saml2_XML._unparse_etree(xml, **kwargs)<EOL><DEDENT>raise ValueError("<STR_LIT>" % type(xml))<EOL>
Serialize an element to an encoded string representation of its XML tree.
:param xml: The root node
:type xml: str|bytes|xml.dom.minidom.Document|etree.Element
:returns: string representation of xml
:rtype: string