def simple_two_grade_jump(agent):
    """This function smoothes the HGC variable in cases in which two grades are completed
    in one year and none in the next year so that one grade is completed in each of the two years.
    E. g. an HGC variable progression of 12 -> 14 -> 14 is changed to 12 -> 13 -> 14.
    """
    cond_1 = agent["HGC"].diff().eq(2)
    cond_2 = agent["HGC"].eq(agent["HGC"].shift(-1))
    cond_3 = agent["MONTHS_ATTENDED_SCHOOL"].shift(1).gt(0) & agent["MONTHS_ATTENDED_SCHOOL"].gt(0)

    agent.loc[cond_1 & cond_2 & cond_3, "HGC"] = agent.loc[cond_1 & cond_2 & cond_3, "HGC"] - 1

    return agent