'Given items with block ids, return only the ones that are valid or undecided.'

def filter_valid_items(self, items, block_id_key=(lambda b: b[0])):

    items = list(items)
    block_ids = map(block_id_key, items)
    valid_block_ids = set(self.filter_valid_block_ids(block_ids, True))
    return [b for b in items if (block_id_key(b) in valid_block_ids)]
