def aggregate_flags(flags):
 on = any([(flag is ON) for flag in flags])
 off = any([(flag is OFF) for flag in flags])
 if on:
  if off:
   raise ValueError('ON and OFF flags cannot be mixed.')
  else:
   return ON
 else:
  return (OFF if off else AUTO)

def aggregate_flags ( flags ) : on = any ( [ ( flag is ON ) for flag in flags ] ) off = any ( [ ( flag is OFF ) for flag in flags ] ) if on : if off : raise ValueError ( 'ON and OFF flags cannot be mixed.' ) else : return ON else : return ( OFF if off else AUTO )
returns an aggregated flag given a sequence of flags .