def _generate_cycles(start_date, today, end_date, cycle_length):
    current_date = start_date
    increment = datetime.timedelta(days=(cycle_length / 2.0))
    values = itertools.cycle([0, 100])
    cycles = []
    while current_date < today:
        cycles.append([current_date, next(values)])
        current_date += increment
    cycles.append([today, _get_level(start_date, today, cycle_length)])
    while current_date < end_date:
        cycles.append([current_date, next(values)])
        current_date += increment
    cycles.append([end_date, _get_level(start_date, end_date, cycle_length)])
    return cycles
dataset/ETHPy150Open jessamynsmith/eggtimer-server/periods/views.py/_generate_cycles/original