def oscillate(iterable):
    """Oscillate forward and backward through an iterable."""
    forward = iterable
    backward = iterable[::-1][1:-1]
    while True:
        yield from forward
        yield from backward
