def cast(self, topic, value):
        """ Cast a string to the value based on the datatype """
        datatype_key = topic.meta.get('datatype', 'none')
        result = self._datatypes[datatype_key].cast(topic, value)
        validate_dt = topic.meta.get('validate', None)
        if validate_dt:
            result = self._datatypes[validate_dt].cast(topic, result)
        return result
def cast ( self , topic , value ) : datatype_key = topic . meta . get ( 'datatype' , 'none' ) result = self . _datatypes [ datatype_key ] . cast ( topic , value ) validate_dt = topic . meta . get ( 'validate' , None ) if validate_dt : result = self . _datatypes [ validate_dt ] . cast ( topic , result ) return result
Cast a string to the value based on the datatype