Get rid of set comprehension, as this doesn't exist in Python 2.6.
Move back to __import__ for 2.6
Don't rely on the ElementTree Comment factory being the tag attribute on Comments.

This is needed for xml.etree.cElementTree under 2.6 (and likely hence custom
installs of cElementTree 1.2), where the tag property is equal to
xml.etree.ElementTree.Comment (i.e., the pure Python version).

Similarly, don't rely on type(comment.tag), as this is just function!
Remove the "XHTML" Serializer.

This never did what it claimed, and never actually guaranteed its
output was well-formed XML, and hence provided little of use.
(The only thing it was good at was producing stylized HTML, and this
can be done by manually setting the relevant options without having
a misleadingly named module.)

If you want XHTML, use one of the tree-builders that supports it
natively. These are DOM (with most DOM implementations, inc. the
standard library minidom with its Node.toxml function) and
ElementTree (ElementTree.tostring gives XML). Neither simpletree nor
the deprecated BeautifulSoup tree-builders support this.

If you want polyglot, there is no solution. I (personally) would be
happy to add a polyglot serializer to html5lib if one is written.
Remove the long-deprecated BeautifulSoup support.

As has been stated before, this was deprecated due to lack of
namespace support, hence making it impossible for it to represent
any tree containing foreign content.