def first_last(idx, seq):
    return classes(first=idx == 0, last=idx == len(seq) - 1)
Generate ``first`` or ``last`` or both, according to the
dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py/first_last