def treat_timer(timer):
    """
    Remove first and last iteration in order to make the callback consistent
    Params:
        timer (dict): timer callback return by active search

    Return:
        (dict): A dictionary with callbacks from the 3 to the penultimate
            iteration
    """
    for key in timer:

        if key not in ["timer_save", "callback_save", "saving_weights",
                       "plots", "background_points", "pos_nn", "neg_nn",
                       "disagreement_point"]:
            timer[key] = timer[key][1:]

        if key not in ["iterations", "timer_save"]:
            timer[key] = timer[key][:-1]
    return timer