'Assert that an option value is valid.'

def assert_option_value_allowed(self, option_type, value):

    if (option_type == u'bool'):
        valid = ((value is True) or (value is False))
    elif (option_type == u'int'):
        valid = (value == int(value))
    elif (option_type == u'int_all'):
        valid = ((value == u'all') or (value == int(value)))
    else:
        assert (option_type == u'text')
        valid = isinstance(value, text_type)
    if (not valid):
        raise ValueError((u'invalid    value    "%s"    for    type    "%s"' % (repr(value), option_type)))
