Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_xml(self, root=None, header=True, pretty=False, dasherize=True):
"""Convert the object to an xml string.
Args:
root: The name of the root element for xml output.
header: Whether to include the xml header.
pretty: Whether to "pretty-print" format the output.
dasherize: Whether to dasherize the xml attribute names.
Returns:
An xml string.
"""
if not root:
root = self._singular
return util.to_xml(self.to_dict(), root=root,
header=header, pretty=pretty,
dasherize=dasherize)