def validate(self, value, model_instance):
        super(GitObjectField, self).validate(value, model_instance)
        oid = model_instance.__dict__[self.name]
        try:
            obj = model_instance._meta.workspace.repo[oid]
        except (__HOLE__, KeyError):
            raise ValidationError('invalid_oid', self)
        if self.type and not isinstance(obj, self.type):
            raise ValidationError('invalid_type', self,
                                  type=self.type.__name__)
dataset/ETHPy150Open bendavis78/python-gitmodel/gitmodel/fields.py/GitObjectField.validate