<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def query_all(kind='1', by_count=False, by_order=True):
        '''
        Qeury all the categories, order by count or defined order.
        '''
        if by_count:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.count.desc())
        elif by_order:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.order)
        else:
            recs = TabTag.select().where(TabTag.kind == kind).order_by(TabTag.uid)
        return recs