def successor_of(element, iterable, pairwise=pairwise):
    """Returns the successor of `element` in `iterable`"""
    for l, r in pairwise(iterable):
        if l == element:
            return r
    raise IndexError
