<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setOption(self, name, value):
 """ Set an AMPL option to a specified value. Args: name: Name of the option to be set (alphanumeric without spaces). value: The value the option must be set to. Raises: InvalidArgumet: if the option name is not valid. TypeError: if the value has an invalid type. """

        if isinstance(value, bool):
            lock_and_call(
                lambda: self._impl.setBoolOption(name, value),
                self._lock
            )
        elif isinstance(value, int):
            lock_and_call(
                lambda: self._impl.setIntOption(name, value),
                self._lock
            )
        elif isinstance(value, float):
            lock_and_call(
                lambda: self._impl.setDblOption(name, value),
                self._lock
            )
        elif isinstance(value, basestring):
            lock_and_call(
                lambda: self._impl.setOption(name, value),
                self._lock
            )
        else:
            raise TypeError