def make_limit_node(root, limit):
<EOL>limit_node = etree.SubElement(root, '<STR_LIT>',<EOL>{'<STR_LIT:class>': limit._limit_full_name})<EOL>for attr in sorted(limit.attrs):<EOL><INDENT>desc = limit.attrs[attr]<EOL>attr_type = desc.get('<STR_LIT:type>', str)<EOL>value = getattr(limit, attr)<EOL>if '<STR_LIT:default>' in desc:<EOL><INDENT>default = (desc['<STR_LIT:default>']() if callable(desc['<STR_LIT:default>']) else<EOL>desc['<STR_LIT:default>'])<EOL>if value == default:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>attr_node = etree.SubElement(limit_node, '<STR_LIT>', name=attr)<EOL>if attr_type == list:<EOL><INDENT>for val in value:<EOL><INDENT>val_node = etree.SubElement(attr_node, '<STR_LIT:value>')<EOL>val_node.text = str(val)<EOL><DEDENT><DEDENT>elif attr_type == dict:<EOL><INDENT>for key, val in sorted(list(value.items()), key=lambda x: x[<NUM_LIT:0>]):<EOL><INDENT>val_node = etree.SubElement(attr_node, '<STR_LIT:value>', key=key)<EOL>val_node.text = str(val)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>attr_node.text = str(value)<EOL><DEDENT><DEDENT>
Given a Limit object, generate an XML node.

:param root: The root node of the XML tree being built.
:param limit: The Limit object to serialize to XML.