def _filter_by_policy(self, block_candidates, policy, biiresponse,
                          original_date=None, request=None):
        delta_versions = []
        for block_candidate in block_candidates:
            self.security.check_read_block(block_candidate)
            biiresponse.info("Block candidate: %s" % str(block_candidate))
            block = self._store.read_block(block_candidate)

            # from last to 0, backwards
            for num_version in range(len(block.deltas) - 1, -1, -1):
                tag = block.deltas[num_version].tag
                date = block.deltas[num_version].date
                if request:
                    if not request.downgrade and date <= original_date:
                        continue
                version = BlockVersion(block.ID, num_version)
                ev = policy.evaluate(version, tag)
                if ev:
                    heappush(delta_versions, ((-date, -num_version), version))
                    biiresponse.info("\tVersion %s (%s) valid" % (version, tag))
                else:
                    biiresponse.info("\tVersion %s (%s) discarded" % (version, tag))

        return delta_versions
computes list of (block_delta, block_version) for each block candidate
dataset/ETHPy150Open biicode/bii-server/find/finder_service.py/FindService._filter_by_policy