'Given block ids, return only the ones that are valid.'

def filter_valid_block_ids(self, block_ids, include_undecided=False):

    block_ids = list(set(block_ids))
    votes = query.get_votes_for_blocks_by_voter(self.connection, block_ids, self.me)
    votes = {vote['vote']['voting_for_block']: vote['vote']['is_block_valid'] for vote in votes}
    return [block_id for block_id in block_ids if votes.get(block_id, include_undecided)]
