def _convert_to_python(self, value, state):
        if isinstance(value, six.string_types):
            value = value.strip().lower()
            if value in self.true_values:
                return True
            if not value or value in self.false_values:
                return False
            raise Invalid(
                self.message('string', state,
                    true=self.true_values[0], false=self.false_values[0]),
                value, state)
        return bool(value)
dataset/ETHPy150Open formencode/formencode/formencode/validators.py/StringBool._convert_to_python/original