OpenStruct for Python.
from ostruct import OpenStruct
car = OpenStruct()
car.make = 'Ford'
car.model = 'Mustang'
car.owner.name = 'John Doe'
car.owner.age = 30
print(car) # {'owner': {'age': 30, 'name': 'John Doe'}, 'make': 'Ford', 'model': 'Mustang'}
$ pip install ostruct
Note: the latest version to support Python 2.7 is ostruct==3.0.1
.