<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_value(self, value, layer=None, source=None):
 """Set a value for a particular layer with optional metadata about source. Parameters value : str Data to store in the node. layer : str Name of the layer to use. If None then the outermost where the value exists will be used. source : str Metadata indicating the source of this value (e.g. a file path) Raises ------ TypeError If the node is frozen KeyError If the named layer does not exist """

        if self._frozen:
            raise TypeError('Frozen ConfigNode does not support assignment')

        if not layer:
            layer = self._layers[-1]
        self._values[layer] = (source, value)