code: def convert(self, value, view):
          
          if (SUPPORTS_ENUM and isinstance(self.choices, type)
                  and issubclass(self.choices, enum.Enum)):
              try:
                  return self.choices(value)
              except ValueError:
                  self.fail(
                      u'must be one of {0!r}, not {1!r}'.format(
                          [c.value for c in self.choices], value
                      ),
                      view
                  )
  
          if value not in self.choices:
              self.fail(
                  u'must be one of {0!r}, not {1!r}'.format(
                      list(self.choices), value
                  ),
                  view
              )
  
          if isinstance(self.choices, abc.Mapping):
              return self.choices[value]
          else:
              return value
docs: Ensure that the value is among the choices (and remap if the
          choices are a mapping).