def xml_to_bytes(element, pretty_print=False):
if use_lxml:<EOL><INDENT>xml = etree.tostring(<EOL>element, encoding="<STR_LIT>", xml_declaration=True, pretty_print=pretty_print<EOL>)<EOL><DEDENT>else:<EOL><INDENT>xml = etree.tostring(element, encoding="<STR_LIT>")<EOL>if not xml.startswith(b"<STR_LIT>"):<EOL><INDENT>xml = b'<STR_LIT>' + xml<EOL><DEDENT><DEDENT>assert xml.startswith(b"<STR_LIT>")  <EOL>return xml<EOL>
Wrapper for etree.tostring, that takes care of unsupported pretty_print
    option and prepends an encoding header.