def to_native(self, value, context=None):
        if isinstance(value, StateObject):
            return value
        try:
            int_value = int(value)
            try:
                return STATES.values()[int_value]
            except __HOLE__:
                return STATE_UNKNOWN
        except ValueError:
            try:
                return STATES[value.lower()]
            except KeyError:
                raise ValidationError(self.messages['choices'].format(
                    unicode(self.choices)))
dataset/ETHPy150Open cloudtools/nymms/nymms/schemas/types/__init__.py/StateType.to_native