def first(condition_function, sequence, default=None):
    """\
    Return first item in sequence where condition_function(item) == True,
    or None if no such item exists.
    """
    for item in sequence:
        if condition_function(item):
            return item
    return default