code: def to_string(xml, **kwargs):
          
  
          if isinstance(xml, OneLogin_Saml2_XML._text_class):
              return xml
  
          if isinstance(xml, OneLogin_Saml2_XML._element_class):
              OneLogin_Saml2_XML.cleanup_namespaces(xml)
              return OneLogin_Saml2_XML._unparse_etree(xml, **kwargs)
  
          raise ValueError("unsupported type %r" % type(xml))
docs: 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