def __init__(self, max_depth=None, flags=None, sub_attrs=None, attrs=None, *args, **kwargs):
        if 'error_messages' in kwargs.keys():
            kwargs['error_messages'].update(self.error_messages)
        else:
            kwargs['error_messages'] = self.error_messages

        self.max_depth = (max_depth if max_depth and max_depth >= 0 else None)

        if 'widget' not in kwargs.keys():
            schema = None
            #Here it needs to be clearer, because this is only useful when creating an object,
            #if no default value is provided, default is callable
            if 'initial' in kwargs and not callable(kwargs['initial']):
                if isinstance(kwargs['initial'], dict):
                    schema = kwargs['initial']

            #here if other parameters are passed, like max_depth and flags, then we hand them to the dict
            kwargs['widget'] = Dictionary(max_depth=max_depth, flags=flags, schema=schema, sub_attrs=sub_attrs)

        super(DictField, self).__init__(*args, **kwargs)
dataset/ETHPy150Open MongoEngine/django-mongoengine/django_mongoengine/forms/fields.py/DictField.__init__/original