'Convert dict values to DictModel values.'

def __init__(self, *args, **kwargs):

    super(DictModel, self).__init__(*args, **kwargs)
    def needs_upgrade(item):
        'Check    if    `item`    is    a    dict    and    needs    to    be    changed    to    DictModel.\n                                                '
        return (isinstance(item, dict) and (not isinstance(item, DictModel)))
    def upgrade(item):
        'Upgrade    item    if    it    needs    to    be    upgraded.'
        if needs_upgrade(item):
            return DictModel(item)
        else:
            return item
    for (key, value) in self.items():
        if isinstance(value, (list, tuple)):
            self[key] = type(value)((upgrade(item) for item in value))
        elif needs_upgrade(value):
            self[key] = DictModel(value)
