def canonicalize(xml, c14n_exc=True):
 output = StringIO()
 if (lxml is not None):
  et = lxml.etree.parse(StringIO(xml))
  et.write_c14n(output, exclusive=c14n_exc)
 else:
  from .simplexml import SimpleXMLElement
  SimpleXMLElement(xml).write_c14n(output, exclusive=c14n_exc)
 return output.getvalue()

def canonicalize ( xml , c14n_exc = True ) : output = StringIO ( ) if ( lxml is not None ) : et = lxml . etree . parse ( StringIO ( xml ) ) et . write_c14n ( output , exclusive = c14n_exc ) else : from . simplexml import SimpleXMLElement SimpleXMLElement ( xml ) . write_c14n ( output , exclusive = c14n_exc ) return output . getvalue ( )
adds a canonical url for the current document in the rendering context .