def _handle_event_colors(unique_events, color, unique_events_id):
 if (color is None):
  if (len(unique_events) > len(COLORS)):
   warn('More events than colors available. You should pass a list of unique colors.')
  colors = cycle(COLORS)
  color = dict()
  for (this_event, this_color) in zip(sorted(unique_events_id), colors):
   color[this_event] = this_color
 else:
  for this_event in color:
   if (this_event not in unique_events_id):
    raise ValueError(('%s from color is not present in events or event_id.' % this_event))
  for this_event in unique_events_id:
   if (this_event not in color):
    warn(('Color is not available for event %d. Default colors will be used.' % this_event))
 return color

def _handle_event_colors ( unique_events , color , unique_events_id ) : if ( color is None ) : if ( len ( unique_events ) > len ( COLORS ) ) : warn ( 'More events than colors available. You should pass a list of unique colors.' ) colors = cycle ( COLORS ) color = dict ( ) for ( this_event , this_color ) in zip ( sorted ( unique_events_id ) , colors ) : color [ this_event ] = this_color else : for this_event in color : if ( this_event not in unique_events_id ) : raise ValueError ( ( '%s from color is not present in events or event_id.' % this_event ) ) for this_event in unique_events_id : if ( this_event not in color ) : warn ( ( 'Color is not available for event %d. Default colors will be used.' % this_event ) ) return color
function for handling event colors .