def to_python(self, value):
<EOL>if value is None:<EOL><INDENT>return None<EOL><DEDENT>if not isinstance(value, six.string_types):<EOL><INDENT>raise forms.ValidationError(<EOL>"<STR_LIT>",<EOL>code='<STR_LIT>',<EOL>)<EOL><DEDENT>try:<EOL><INDENT>final = getattr(self.choices, value)<EOL><DEDENT>except AttributeError:<EOL><INDENT>available = '<STR_LIT>' % '<STR_LIT:U+002CU+0020>'.join(self.choices.constants)<EOL>raise forms.ValidationError(<EOL>"<STR_LIT>" % available,<EOL>code='<STR_LIT>',<EOL>)<EOL><DEDENT>return final<EOL>
Convert the constant to the real choice value.