def sanitize_index_lists(ind):
 if (not isinstance(ind, (list, np.ndarray))):
  return ind
 if isinstance(ind, np.ndarray):
  ind = ind.tolist()
 if (isinstance(ind, list) and ind and isinstance(ind[0], bool)):
  ind = [a for (a, b) in enumerate(ind) if b]
 return ind

def sanitize_index_lists ( ind ) : if ( not isinstance ( ind , ( list , np . ndarray ) ) ) : return ind if isinstance ( ind , np . ndarray ) : ind = ind . tolist ( ) if ( isinstance ( ind , list ) and ind and isinstance ( ind [ 0 ] , bool ) ) : ind = [ a for ( a , b ) in enumerate ( ind ) if b ] return ind
handle lists/arrays of integers/bools as indexes .