def exactly_n(l, n=1):
    i = iter(l)
    return all(any(i) for j in range(n)) and not any(i)
Tests that exactly N items in an iterable are "truthy" (neither None,
dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/exactly_n