def get_cat_sample_groups(sam_cats):
 cat_sam_groups = defaultdict(list)
 for (k, v) in sam_cats.iteritems():
  cat_sam_groups[v].append(k)
 return cat_sam_groups

def get_cat_sample_groups ( sam_cats ) : cat_sam_groups = defaultdict ( list ) for ( k , v ) in sam_cats . iteritems ( ) : cat_sam_groups [ v ] . append ( k ) return cat_sam_groups
create {category_value:[samples_with_that_value]} dict .