def set_option_value(self, name, value):
option = self.get_option(name)<EOL>old_value = option.value<EOL>if option.type in ('<STR_LIT:str>', '<STR_LIT>'):<EOL><INDENT>option.value = value<EOL><DEDENT>elif option.type == '<STR_LIT:int>':<EOL><INDENT>value = value.lower()<EOL>if not value.isdigit():<EOL><INDENT>if value.startswith('<STR_LIT>') and string_is_hex(value[<NUM_LIT:2>:]):<EOL><INDENT>value = int(value[<NUM_LIT:2>:], <NUM_LIT:16>)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT><DEDENT>option.value = int(value)<EOL><DEDENT>elif option.type == '<STR_LIT>':<EOL><INDENT>if value.count('<STR_LIT:.>') > <NUM_LIT:1>:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>if not value.replace('<STR_LIT:.>', '<STR_LIT>').isdigit():<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>option.value = float(value)<EOL><DEDENT>elif option.type == '<STR_LIT:bool>':<EOL><INDENT>if value.lower() in ['<STR_LIT:true>', '<STR_LIT:1>', '<STR_LIT>']:<EOL><INDENT>option.value = True<EOL><DEDENT>elif value.lower() in ['<STR_LIT:false>', '<STR_LIT:0>', '<STR_LIT>']:<EOL><INDENT>option.value = False<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if option.callback and not option.callback(value, old_value):<EOL><INDENT>option.value = old_value<EOL>return False<EOL><DEDENT>return True<EOL>
Set an option's value.

:param str name: The name of the option to set the value for.
:param str value: The value to set the option to, it will be converted from a string.
:return: The previous value for the specified option.