def clean(self, value):
        """clean a value, converting and performing bounds checking"""
        if not isinstance(value, self.t):
            value = self.t(value)

        if not self.allow_negative and value < 0:
            raise ValueError('value was negative')

        if not self.allow_positive and value > 0:
            raise ValueError('values was positive')

        return value
def clean ( self , value ) : if not isinstance ( value , self . t ) : value = self . t ( value ) if not self . allow_negative and value < 0 : raise ValueError ( 'value was negative' ) if not self . allow_positive and value > 0 : raise ValueError ( 'values was positive' ) return value
clean a value, converting and performing bounds checking