def count_key_value(obj, key, value):
            """
            Recursively count how many times `obj[key] == value` appears in a nested structure.
            """
            count = 0
            if isinstance(obj, dict):
                if obj.get(key) == value:
                    count += 1
                for v in obj.values():
                    count += count_key_value(v, key, value)
            elif isinstance(obj, list):
                for item in obj:
                    count += count_key_value(item, key, value)
            return count

            Recursively count how many times `obj[key] == value` appears in a nested structure.
            
test/test_blocks.py