import xml.etree.ElementTree as ET def xml_reserialize(raw: bytes) -> str: root = ET.fromstring(raw) return '\n' + ET.tostring(root, encoding="unicode")