if you write this as follows it will always return True or False

```
if-1:
    ...
return isinstance(cond, Piecewise) and all(_is_valid_cond(c)
    for e, c in cond.args)
```