def filter_limit_query(model, query, hints):
 if (hints is None):
  return query
 query = _filter(model, query, hints)
 if hints.cannot_match:
  return []
 if (not hints.filters):
  return _limit(query, hints)
 else:
  return query

def filter_limit_query ( model , query , hints ) : if ( hints is None ) : return query query = _filter ( model , query , hints ) if hints . cannot_match : return [ ] if ( not hints . filters ) : return _limit ( query , hints ) else : return query
apply filtering and limit to a query .