Python itertools.compress Function
The itertools.compress function in Python’s itertools module filters elements from an iterable based on the values of a selector iterable. It is useful for selecting elements from one iterable when the corresponding elements in another iterable are true.