<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):
 """Return a count of instances."""

        if self._primary_keys is None:
            return self.queryset.count()
        else:
            return len(self.pks)