try:
return monkey.TypeWriter().Manufacturer().Shareholders().EthnicDistribution()
except AttributeError:
return None
Try to get the thing. If it doesn't work, you know one of the levels was missing. This works particularly nicely if those GetBelowObject
calls aren't actually all the same method.