Python model object validation
<p>I'm writing an interface to be used by two applications. This interface should use some <code>DoSomethingRequest</code> and <code>DoSomethingResponse</code> classes to do the communication.</p>

<p>Is there any library that does some model validation, for example like Django's <code>Model</code>?</p>

<p>I basically want to be able to say something like:<br>
Object A must have a "text" property of type str(), a "number" property of type int(), an "items" property of type list(). In a DRY way.</p>

<p>I'm looking for something like the following, or better:</p>

<pre><code>class MyEmbeddedModelClass(EmbeddedModel):
    text = TextField(required = True)

class MyModel(Model):
    text = TextField(required = True)
    number = IntField(default = 0)
    items = ListField(EmbeddedModel)


a = MyModel()
a.text = "aaaa"
a.number = 1
a.items = [
    MyEmbeddedModelClass("bbbb"),
    MyEmbeddedModelClass("cccc"),
    MyEmbeddedModelClass("dddd")
]
a.validate()
</code></pre>

<p>I know I can write my own, but I'd rather use a library if available, I'm a bit new to this.</p>
