def first(a, fn):
    """
    Example: first([3,4,5,6], lambda x: x > 4)

    :param a: array
    :param fn: function to evaluate items
    :return: None or first item matching result
    """
    return next((x for x in a if fn(x)), None)