def _assert_obj_type(pub, name="pub", obj_type=DBPublication):
    """
    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`.
    """
    if not isinstance(pub, obj_type):
        raise InvalidType(
            "`%s` have to be instance of %s, not %s!" % (
                name,
                obj_type.__name__,
                pub.__class__.__name__
            )
        )