I have a fairly complex object (deserialized json, so I don't have too much control over it) that I need to check for the existence of and iterate over a fairly deep elements, so right now I have something like this:
if a.get("key") and a["key"][0] and a["key"][0][0] :
for b in a["key"][0][0] :
#Do something
which works, but is pretty ugly. It seems there has to be a better way to do this, so what's a more elegant solution?