def count(self):
count = <NUM_LIT:0><EOL>operation = self._get_operation()<EOL>kwargs = self.kwargs.copy()<EOL>kwargs['<STR_LIT>'] = '<STR_LIT>'<EOL>limit = kwargs.get('<STR_LIT>', None)<EOL>while True:<EOL><INDENT>result = operation(self.model.get_table_name(), **kwargs)<EOL>count += result['<STR_LIT>']<EOL>if limit is not None:<EOL><INDENT>limit -= result['<STR_LIT>']<EOL><DEDENT>last_evaluated_key = result.get('<STR_LIT>', None)<EOL>if not self._prepare_next_fetch(kwargs, last_evaluated_key, limit):<EOL><INDENT>break<EOL><DEDENT><DEDENT>return count<EOL>
Total count of the matching items.

        It sums up the count of partial results, and returns the total count of
        matching items in the table.