Python class based structure generator with optional type and restriction checking.