def first(seq, f):
    """Returns first item in seq where f(item) is True, or None.
    
    To invert the function, use lambda f: not f
    """
    for s in seq:
        if f(s):
            return s