<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, data: Union[Mapping, str, bytes], layer: str=None, source: str=None):
 """Adds additional data into the ConfigTree. Parameters data : source data layer : layer to load data into. If none is supplied the outermost one is used source : Source to attribute the values to See Also -------- read_dict """

        if isinstance(data, dict):
            self._read_dict(data, layer, source)
        elif isinstance(data, ConfigTree):
            # TODO: set this to parse the other config tree including layer and source info.  Maybe.
            self._read_dict(data.to_dict(), layer, source)
        elif isinstance(data, str):
            if data.endswith(('.yaml', '.yml')):
                source = source if source else data
                self._load(data, layer, source)
            else:
                try:
                    self._loads(data, layer, source)
                except AttributeError:
                    raise ValueError("The string data should be yaml formated string or path to .yaml/.yml file")
        elif data is None:
            pass
        else:
            raise ValueError(f"Update must be called with dictionary, string, or ConfigTree. "
                             f"You passed in {type(data)}")