def first_true_cond(cond, arr):
    """
    Return the index of the first element such that cond(element) returns True.
    The other way to do this would be where(map(cond, arr))[0][0], of where(cond(arr))[0][0] if cond is vectorized,
    but in some cases (large array, few cond(element) == True)) this function is quicker.
    Note: If no element satisfies the condition, the function returns None
    """
    for i, a in enumerate(arr):
        if cond(a):
            return i
    return None