The first item in that sequence that matches that predicate

    If none matches raise a KeyError with that message

def first_that(predicate, sequence, message=None):
    """The first item in that sequence that matches that predicate

    If none matches raise a KeyError with that message
    """
    try:
        return next(ifilter(predicate, sequence))
    except StopIteration:
        raise KeyError(message or 'Not Found')