def nested_contains what where if what in where return True for in whe

1
2
3
4
5
6
7
8
def nested_contains(what, where):
if what in where:
return True
for x in where:
if isinstance(x, (list, tuple)):
if nested_contains(what, x):
return True
return False