def first_true_index(iterable, pred=None, default=None):
 if (pred is None):
  func = operator.itemgetter(1)
 else:
  func = (lambda x: pred(x[1]))
 ii = next(filter(func, enumerate(iterable)), default)
 return (ii[0] if ii else default)

def first_true_index ( iterable , pred = None , default = None ) : if ( pred is None ) : func = operator . itemgetter ( 1 ) else : func = ( lambda x : pred ( x [ 1 ] ) ) ii = next ( filter ( func , enumerate ( iterable ) ) , default ) return ( ii [ 0 ] if ii else default )
find the first index position for the which the callable pred returns true .