def filter_adjacent(iterable):
    """Collapse identical adjacent values"""
    current = type(str('Marker'), (object,), {})
    for item in iterable:
        if item != current:
            current = item
            yield item
