def first_or_default(iterable, predicate=None, default=None):
    """First the first value matching a perdicate otherwise a default value.

    :param iterable: The items over which to iterate.
    :param predicate: A predicate to apply to each item.
    :param default: The value to return if no item matches.
    :return: The first value matching a predicate otherwise the default value.
    """
    for item in iterable:
        if not predicate or predicate(item):
            return item
    return default