pretty prints an ElementTree (or an Element of it), or the XML
    representation of a SaltDocument (or an element
    thereof, e.g. a node, edge, layer etc.)

def xmlprint(element):
    """
    pretty prints an ElementTree (or an Element of it), or the XML
    representation of a SaltDocument (or an element
    thereof, e.g. a node, edge, layer etc.)
    """
    if isinstance(element, (etree._Element, etree._ElementTree)):
        print etree.tostring(element, pretty_print=True)
    else:
        if hasattr(element, 'xml'):
            print etree.tostring(element.xml, pretty_print=True)