'Parses request and returns a list of filter callables.
Each callable will be called with the StatEntry and returns True if the
entry should be suppressed.
Args:
request: A FindSpec that describes the search.
Returns:
a list of callables which return True if the file is to be suppressed.'

def BuildChecks(self, request):

    result = []
    if (request.HasField('start_time') or request.HasField('end_time')):
        def FilterTimestamp(file_stat, request=request):
            return (file_stat.HasField('st_mtime') and ((file_stat.st_mtime < request.start_time) or (file_stat.st_mtime > request.end_time)))
        result.append(FilterTimestamp)
    if (request.HasField('min_file_size') or request.HasField('max_file_size')):
        def FilterSize(file_stat, request=request):
            return (file_stat.HasField('st_size') and ((file_stat.st_size < request.min_file_size) or (file_stat.st_size > request.max_file_size)))
        result.append(FilterSize)
    if request.HasField('perm_mode'):
        def FilterPerms(file_stat, request=request):
            return ((file_stat.st_mode & request.perm_mask) != request.perm_mode)
        result.append(FilterPerms)
    if request.HasField('uid'):
        def FilterUID(file_stat, request=request):
            return (file_stat.st_uid != request.uid)
        result.append(FilterUID)
    if request.HasField('gid'):
        def FilterGID(file_stat, request=request):
            return (file_stat.st_gid != request.gid)
        result.append(FilterGID)
    if request.HasField('path_regex'):
        regex = request.path_regex
        def FilterPath(file_stat, regex=regex):
            'Suppress    any    filename    not    matching    the    regular    expression.'
            return (not regex.Search(file_stat.pathspec.Basename()))
        result.append(FilterPath)
    if request.HasField('data_regex'):
        def FilterData(file_stat, **_):
            'Suppress    files    that    do    not    match    the    content.'
            return (not self.TestFileContent(file_stat))
        result.append(FilterData)
    return result
