def leaf_count(self):
        """
        The number of leaf category nodes under this category. Returns
        1 if this category has no sub-categories.
        """
        if not self._sub_categories:
            return 1
        return sum(category.leaf_count for category in self._sub_categories)
def leaf_count ( self ) : if not self . _sub_categories : return 1 return sum ( category . leaf_count for category in self . _sub_categories )
The number of leaf category nodes under this category. Returns
        1 if this category has no sub-categories.