code: def count(self, **kwargs):
          
          if 'select' in kwargs:
              kwargs['select'] = {'cnt': 'COUNT(%s)' % kwargs['select']}
          else:
              kwargs['select'] = {'cnt': 'COUNT(*)'}
  
          res = self.db_adapter(
              db_name=kwargs.get('db'),
              role=kwargs.get('role', 'replica')
              ).select(**kwargs)
          return res.cnt[0]
docs: Performs a COUNT statement on the model's table in the replica database.
  
          :param select: Column to be counted.
          :type select: string
          :param where: WHERE clause of the SELECT statement. This can be a plain string, a dict or an array.
          :type where: string, dict, array
          :param db: Database name from your ``jardin_conf.py``, overrides the default database set in the model declaration.
          :type db: string
          :param role: One of ``('master', 'replica')`` to override the default.
          :type role: string
          :returns: integer