def valid(self):
    if (not self.value):
        return True
    if (((len(self.value) == 3) or (len(self.value) == 6)) and re.match('^[A-Fa-f0-9]*$', self.value)):
        return True
    else:
        return ('Not a valid hex color of format RRGGBB (like FF0000 for red): %s' % self.value)
def valid(self):
    if (not self.value):
        return True
    if (((len(self.value) == 3) or (len(self.value) == 6)) and re.match('^[A-Fa-f0-9]*$', self.value)):
        return True
    else:
        return ('Not a valid hex color of format RRGGBB (like FF0000 for red): %s' % self.value)