code: def element_statistics(tree, element_type):
      
      elements = get_elements(tree, element_type)
      stats = defaultdict(int)
      for i, element in enumerate(elements):
          stats[get_xsi_type(element)] += 1
      for (etype, count) in stats.items():
          print "{0}: {1}".format(etype, count)
docs: Prints the names and counts of all elements present in an
      `etree._ElementTree`, e.g. a SaltDocument::
  
          SStructure: 65
          SSpan: 32
          SToken: 154
          STextualDS: 1
  
      Parameters
      ----------
      tree : lxml.etree._ElementTree
          an ElementTree that represents a complete SaltXML document
      element_type : str
          an XML tag, e.g. 'nodes', 'edges', 'labels'