Culling tree branches

Guys
How to cull specific branches of a tree according to True/False pattern?
This is my approach (works on trees with rather simple structure). Is there anything else out there?

Something like this?

something like this?

image

Such a simple and brilliant solution.
Thank you both.

NICE! Done with 2 components (if you want to keep T or F only).

Here is a Python option.
Python_CullTreeBranches.gh (4.7 KB)

Hello
You an also use Split tree