<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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()