def tree_statistics(tree):
    """
    prints the types and counts of elements present in a SaltDocument tree,
    e.g.::

        layers: 3
        sDocument: 1
        nodes: 252
        labels: 2946
        edges: 531

    """
    all_elements = tree.findall('//')
    tag_counter = defaultdict(int)
    for element in all_elements:
        tag_counter[element.tag] += 1
    for (tag, counts) in tag_counter.items():
        print "{0}: {1}".format(tag, counts)