def coerce(cls, value):
		if cls.check( value ):
			return value
		elif isinstance( value, (str,unicode) ):
			if value and value[0] == '#':
				rest = value[1:]
				if rest:
					value = int( rest, 16)
					return wx.Colour( value >> 16  & 255, value >> 8  & 255, value & 255 )
				else:
					return wx.Colour( 0,0,0)
			else:
				try:
					obj = wx.Colour( value )
				except (ValueError,TypeError):
					global COLOUR_DB_INITIALISED
					if not COLOUR_DB_INITIALISED:
						COLOUR_DB_INITIALISED = 1
						colourdb.updateColourDB()
					obj = wx.NamedColour( value )
					if not obj.Ok():
						raise ValueError( """Unrecognised string value %r for Colour value"""%(value))
		elif isinstance( value, (tuple,list) ):
			if len(value) == 3:
				obj = wx.Colour( *value )
			else:
				raise ValueError( """Unable to create wx.Colour from %r, incorrect length"""%( value ))
		elif value is None:
			return wx.Colour( 0,0,0)
		else:
			raise TypeError( """Unable to convert value %r (type %s) to wx.Colour object"""%( value, type(value)))
		return obj
Attempt to convert the given value to a wx.Colour
dataset/ETHPy150Open correl/Transmission-XBMC/resources/lib/basictypes/wx/colour.py/wxColour_DT.coerce