def count(self, model_class, conditions=None):
query = '<STR_LIT>'<EOL>if conditions:<EOL><INDENT>query += '<STR_LIT>' + conditions<EOL><DEDENT>query = self._substitute(query, model_class)<EOL>r = self._send(query)<EOL>return int(r.text) if r.text else <NUM_LIT:0><EOL>
Counts the number of records in the model's table.

- `model_class`: the model to count.
- `conditions`: optional SQL conditions (contents of the WHERE clause).