'Get the effective DAL query'

def get_query(self):

    if (self.query is not None):
        return self.query
    resource = self.resource
    query = reduce((lambda x, y: (x & y)), self.queries, self.mquery)
    if self.filters:
        if (self.transformed is None):
            filters = reduce((lambda x, y: (x & y)), self.filters)
            transformed = filters.transform(resource)
            self.transformed = transformed
            (self.rfltr, self.vfltr) = transformed.split(resource)
        rfltr = self.rfltr
        if isinstance(rfltr, S3ResourceQuery):
            rq = rfltr.query(resource)
            if (rq is not False):
                query &= rq
        elif (rfltr is not None):
            query &= rfltr
    self.query = query
    return query
