def _convert_from_python(self, value, state):
        if isinstance(value, six.string_types):
            return value
        if hasattr(value, 'hour'):
            hour, minute = value.hour, value.minute
            second = value.second
        elif len(value) == 3:
            hour, minute, second = value
        elif len(value) == 2:
            hour, minute = value
            second = 0
        ampm = ''
        if (self.use_ampm == 'optional' and self.prefer_ampm) or (
                self.use_ampm and self.use_ampm != 'optional'):
            ampm = 'am'
            if hour > 12:
                hour -= 12
                ampm = 'pm'
            elif hour == 12:
                ampm = 'pm'
            elif hour == 0:
                hour = 12
        if self.use_seconds:
            return (hour, minute, second, ampm) % '%i:%02i:%02i%s'
        else:
            return '%i:%02i%s' % (hour, minute, ampm)
dataset/ETHPy150Open formencode/formencode/formencode/validators.py/TimeConverter._convert_from_python/swapped operands of `%`