def to_native(self, value, context=None):
        """ Schematics deserializer override

        We return a us.states.State object so the abbreviation
        or long name can be trivially accessed. Additionally,
        some geo type ops are available.

        TIP: The us.states library expects unicode so we
             must ensure value is encoded properly.

        :return: us.states.State
        """

        if isinstance(value, us.states.State):
            return value

        try:
            state = us.states.lookup(unicode(value))
            if not state:
                raise TypeError
            return state
        except TypeError:
            raise ConversionError(self.messages['convert'])
def to_native ( self , value , context = None ) : if isinstance ( value , us . states . State ) : return value try : state = us . states . lookup ( unicode ( value ) ) if not state : raise TypeError return state except TypeError : raise ConversionError ( self . messages [ 'convert' ] )
Schematics deserializer override

        We return a us.states.State object so the abbreviation
        or long name can be trivially accessed. Additionally,
        some geo type ops are available.

        TIP: The us.states library expects unicode so we
             must ensure value is encoded properly.

        :return: us.states.State