code: def to_python(self, value):
          
  
          # ``is_required`` is already checked in ``validate``.
          if value is None:
              return None
  
          # Validate the type.
          if not isinstance(value, six.string_types):
              raise forms.ValidationError(
                  "Invalid value type (should be a string).",
                  code='invalid-choice-type',
              )
  
          # Get the constant from the choices object, raising if it doesn't exist.
          try:
              final = getattr(self.choices, value)
          except AttributeError:
              available = '[%s]' % ', '.join(self.choices.constants)
              raise forms.ValidationError(
                  "Invalid value (not in available choices. Available ones are: %s" % available,
                  code='non-existing-choice',
              )
  
          return final
docs: Convert the constant to the real choice value.