for s in seq:
    if not result or s != result[-1][-1] + 1:
        result.append([])
result[-1].append(s)
return result
print(runs([1, 2, 3, 4, 8, 10, 11, 12, 17]))
Python - find incremental numbered sequences with a list comprehension