def get_sample_indices(cat_sam_groups, bt):
 cat_sam_indices = defaultdict(list)
 for (k, v) in cat_sam_groups.iteritems():
  cat_sam_indices[k] = [bt.index(i, axis='sample') for i in v]
 return cat_sam_indices

def get_sample_indices ( cat_sam_groups , bt ) : cat_sam_indices = defaultdict ( list ) for ( k , v ) in cat_sam_groups . iteritems ( ) : cat_sam_indices [ k ] = [ bt . index ( i , axis = 'sample' ) for i in v ] return cat_sam_indices
create {category_value:index_of_sample_with_that_value} dict .