code: def specificity(self):
          
          ids = sum(a.countIDs() for a in self.elements)
          non_ids = sum((a.countNames() - a.countIDs()) for a in self.elements)
          tests = sum(len(a.tests) for a in self.elements)
          
          return (ids, non_ids, tests)
docs: Loosely based on http://www.w3.org/TR/REC-CSS2/cascade.html#specificity