code: def _assert_obj_type(pub, name="pub", obj_type=DBPublication):
      
      if not isinstance(pub, obj_type):
          raise InvalidType(
              "`%s` have to be instance of %s, not %s!" % (
                  name,
                  obj_type.__name__,
                  pub.__class__.__name__
              )
          )
docs: Make sure, that `pub` is instance of the `obj_type`.
  
      Args:
          pub (obj): Instance which will be checked.
          name (str): Name of the instance. Used in exception. Default `pub`.
          obj_type (class): Class of which the `pub` should be instance. Default
                   :class:`.DBPublication`.
  
      Raises:
          InvalidType: When the `pub` is not instance of `obj_type`.