def HasKey(array,key):
result = array
for k in key.split("."):
if isinstance(result,dict) and k in result:
result = result[k]
else:
return False
return True
>>> HasKey(exampe,"Building.Flat.Flat_2.App_4")
True
>>> HasKey(exampe,"Building.Flat.Flat_2.App_5")
False
>>> HasKey(exampe,"Building.Flat.Flat_3.App_4")
False
>>>