<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_columns(self, types):
 """Set the column types args: types: iterable of (column_name, type) pairs. """

        if self._types:
            raise wandb.Error('TypedTable.set_columns called more than once.')
        try:
            for key, type_ in types:
                if type_ not in TYPE_TO_TYPESTRING:
                    raise wandb.Error('TypedTable.set_columns received invalid type ({}) for key "{}".\n  Valid types: {}'.format(
                        type_, key, '[%s]' % ', '.join(VALID_TYPE_NAMES)))
        except TypeError:
            raise wandb.Error(
                'TypedTable.set_columns requires iterable of (column_name, type) pairs.')
        self._types = dict(types)
        self._output.add({
            'typemap': {k: TYPE_TO_TYPESTRING[type_] for k, type_ in types},
            'columns': [t[0] for t in types]})