'Returns `COUNT(*)` for given DocType and filters.'

def count(self, dt, filters=None, debug=False):

    if filters:
        (conditions, filters) = self.build_conditions(filters)
        return frappe.db.sql((u'select    count(*)\n DCTB  DCTB  DCTB  DCTB from    `tab%s`    where    %s' % (dt, conditions)), filters, debug=debug)[0][0]
    else:
        return frappe.db.sql((u'select    count(*)\n DCTB  DCTB  DCTB  DCTB from    `tab%s`' % (dt,)))[0][0]
