def find_if(pred, iterable, default=None):
    """
    Returns a reference to the first element in the ``iterable`` range for
    which ``pred`` returns ``True``. If no such element is found, the
    function returns ``default``.

        >>> find_if(lambda x: x == 3, [1, 2, 3, 4])
        3

    :param pred: a predicate function to check a value from the iterable range
    :param iterable: an iterable range to check in
    :param default: a value that will be returned if no elements were found
    :returns: a reference to the first found element or default
    """
    return next((i for i in iterable if pred(i)), default)