Clarify need for close_subprocess
Fixes for iterators and views instead of lists in Python 3

* Iterators: map(), filter()
* Views: dict.keys(), dict.items() and dict.values()
* Also fixes map(None, . . .) calls, typically invoked to make a copy. In
  some instances no copy is actually necessary.
* Use zip() instead of map(None, . . .)

Inspired using “2to3”.
Simplify “normalisation” of captured XML structure

Text string elements are never adjacent to each other, so there can only ever
be one leading and trailing blank.
Separate XML capturing to separate object and avoid the state checking
Capture <metadata> using Element Tree module
Use Element Tree module to parse the XML as well