the latest lxml.etree.fromstring complains with syntax error when the xml declaration contain 'standalone' but does not contain encoding, apparently the xml declaration attributes have predefined order
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes