The php and python versions of fragment_to_string act differently for xml nodes that aren't fragments. I really should have called fragment_to_string something different, or at least only used it for actual fragments.