def slicer(iterable, *args):
    return chain.from_iterable(islice(iterable, *i) for i in args)
list(slicer(list(range(40)), (2, 8), (10, 16), (30, 38)))
How do i reference values from various ranges within a list?