code: def _validate_color(self, color):
          
  
          three_digit_pattern = compile("^[a-f0-9]{3}$")
          six_digit_pattern = compile("^[a-f0-9]{6}$")
  
          if not match(three_digit_pattern, color)\
              and not match(six_digit_pattern, color):
                  raise InvalidColorError(
                      "{} is not a valid color".format(color)
                  )
  
          return color
docs: Validates color, raising error if invalid.