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