def __setitem__(self, key, value):
    if isinstance(value, dict) and not isinstance(value, dotdictify):
        value = dotdictify(value)
Python: Recursively access dict via attributes as well as index access?