def comparisons(labels, compareall):
    """Return a list of tuples representing the treatments to
       compare. If compareall is false, only comparisons against
       the first treatment are performed. If true, all comparisons
       are done."""
    if compareall:
        return [(x, y) for x in range(len(labels))
                for y in range(len(labels))
                if y < x]
    else:
        return [(x, 0) for x in range(len(labels)) if x != 0]