def __get__(self, instance, owner):
        """
        We return a custom wrapper over dict which tracks changes to the dictionary and allows us
        to only write the field to the database on update if the field value has changed - very
        important since it means much more efficient partial updates.
        """
        value = super().__get__(instance, owner)

        if isinstance(value, dict) and not isinstance(value, BaseDict):
            value = BaseDict(value, instance, self.name)

        # NOTE: It's important this attribute is set, since only this way mongoengine can determine
        # if the field has chaned or not when determing if the value should be written to the db or
        # not
        if instance:
            instance._data[self.name] = value

        return value

        We return a custom wrapper over dict which tracks changes to the dictionary and allows us
        to only write the field to the database on update if the field value has changed - very
        important since it means much more efficient partial updates.
        
st2common/st2common/fields.py