def _serialize(node):
    """
    Serialize a xml node tag and its attribute dict in a reproducible way.
    @param node: xml node to serialize
    """
    tokens = [node.tag]
    for k, v in node.attrib.items():
        tokens.extend([k, v])
    return ' '.join(tokens)