<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_publication(pub):
 """ Save `pub` into database and into proper indexes. Attr: pub (obj):
 Instance of the :class:`.DBPublication`. Returns: obj: :class:`.DBPublication` without data. Raises: InvalidType: When the `pub` is not instance of :class:`.DBPublication`. UnindexablePublication: When there is no index (property) which can be used to index `pub` in database. """

    _assert_obj_type(pub)

    _get_handler().store_object(pub)

    return pub.to_comm(light_request=True)