def indices(a, func):
  """ Returns list of indices where func evals to True 
  @param a: list to be checked
  @param func: Test to be performed
  
  @example: indices(a, lambda x: x==1) returns all the indices of the list that contains value 1
  """ 
  return [i for (i, val) in enumerate(a) if func(val)]