def _decode(self, obj, context, path): if obj not in enum._value2member_map_: raise ValidationError("object failed validation: %s" % (obj, )) return enum(obj)