def validate(self, value):
        """Make sure that value is of the right type """
        if not isinstance(value, self.nested_klass):
            self.raise_error('NestedClass is of the wrong type: {0} vs expected {1}'
                             .format(value.__class__.__name__, self.nested_klass.__name__))
        super(NestedDocumentField, self).validate(value)
Make sure that value is of the right type