code: def _isinstance(self, model, raise_error=True):
          
          rv = isinstance(model, self.__model__)
          if not rv and raise_error:
              raise ValueError('%s is not of type %s' % (model, self.__model__))
          return rv
docs: Checks if the specified model instance matches the class model.
          By default this method will raise a `ValueError` if the model is not of
          expected type.
  
          Args:
  
              model (Model) : The instance to be type checked
  
              raise_error (bool) : Flag to specify whether to raise error on
                  type check failure
  
          Raises:
  
              ValueError: If `model` is not an instance of the respective Model
                  class