def iter_color_groups(mapping, prefs):
 for key in natsort(prefs.keys()):
  col_name = prefs[key]['column']
  if ('colors' in prefs[key]):
   if isinstance(prefs[key]['colors'], dict):
    colors = prefs[key]['colors'].copy()
   else:
    colors = prefs[key]['colors'][:]
  else:
   colors = {}
  labelname = prefs[key]['column']
  groups = group_by_field(mapping, col_name)
  (colors, data_colors, data_color_order) = get_group_colors(groups, colors)
  (yield (labelname, groups, colors, data_colors, data_color_order))

def iter_color_groups ( mapping , prefs ) : for key in natsort ( prefs . keys ( ) ) : col_name = prefs [ key ] [ 'column' ] if ( 'colors' in prefs [ key ] ) : if isinstance ( prefs [ key ] [ 'colors' ] , dict ) : colors = prefs [ key ] [ 'colors' ] . copy ( ) else : colors = prefs [ key ] [ 'colors' ] [ : ] else : colors = { } labelname = prefs [ key ] [ 'column' ] groups = group_by_field ( mapping , col_name ) ( colors , data_colors , data_color_order ) = get_group_colors ( groups , colors ) ( yield ( labelname , groups , colors , data_colors , data_color_order ) )
iterates over color groups for each category given mapping file/prefs .