def check_color(option, opt, value):
 if re.match('[a-z0-9 ]+$', value, re.I):
  return value
 if re.match('#[a-f0-9]{6}', value, re.I):
  return value
 msg = 'option %s: invalid color : %r, should be either hexadecimal     value or predefined color'
 raise OptionValueError((msg % (opt, value)))

def check_color ( option , opt , value ) : if re . match ( '[a-z0-9 ]+$' , value , re . I ) : return value if re . match ( '#[a-f0-9]{6}' , value , re . I ) : return value msg = 'option %s: invalid color : %r, should be either hexadecimal     value or predefined color' raise OptionValueError ( ( msg % ( opt , value ) ) )
check a color value and returns it /! does *not* check color labels .