def activity_index(AC, interval, LightCO, ModerateCO, HardCO, VeryHardCO):
    """
    Calculate activity intensity level using Freedson adult cut points (Freedson, Melanson, & Sirard, 1998).

    :param AC:
        activity count per epoch
    :param interval:
        epoch duration (in seconds)
    :param LightCO:
        light activity cutoff value
    :param ModerateCO:
        moderate activity cutoff value
    :param HardCO:
        hard activity cutoff value
    :param VeryHardCO:
        very hard activity cutoff value
    :return:
        integer value corresponding to the activity intensity
    """

    ## assume epoch smaller than 1 minute
    assert interval <= 60, "Epoch larger than 1 minute."

    ## normalize the cutoffs per epoch
    n = 60 / interval
    VeryHardCO = VeryHardCO / n
    HardCO = HardCO / n
    ModerateCO = ModerateCO / n
    LightCO = LightCO / n

    if AC == -1:
        act_index = -1  # state unknown
    elif AC == -2:
        act_index = -2  # not wearing device
    elif 0 <= AC < LightCO:
        act_index = 0  # sedentary
    elif LightCO <= AC < ModerateCO:
        act_index = 1  # light activity
    elif ModerateCO <= AC < HardCO:
        act_index = 2  # moderate activity
    elif HardCO <= AC < VeryHardCO:
        act_index = 3  # hard activity
    else:
        act_index = 4  # very hard activity

    return act_index