code: def validate(self, name, value):
          
  
          if self.valid_set and value not in self.valid_set:
              raise ImproperlyConfigured(
                  "%s: \"%s\" is not a valid setting (choose between %s)." %
                  (name, value, ", ".join("\"%s\"" % x for x in self.valid_set)))
  
          return value
docs: Validate and return a value.