def count(self, *criterion, **kwargs):
        """
        Count the number of models matching some criterion.

        """
        query = self._query(*criterion)
        query = self._filter(query, **kwargs)
        return query.count()
Count the number of models matching some criterion.