<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def after_batch(self, stream_name: str, batch_data: Batch):
 """ Extend the accumulated variables with the given batch data. :param batch_data: batch data = stream sources + model outputs :raise KeyError: if the variables to be aggregated are missing :raise TypeError: if the variable value is not iterable (e.g. it is only a scalar) """

        for variable in self._variables:
            if variable in batch_data:
                value = batch_data[variable]
                if not hasattr(value, '__iter__'):
                    raise TypeError('Variable `{}` to be accumulated is not iterable.'.format(variable))
                self._accumulator[stream_name][variable] += list(value)
            else:
                raise KeyError('Variable `{}` to be accumulated was not found in the batch data. '
                               'Available variables are `{}`.'.format(variable, batch_data.keys()))