<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_index(self, keys):
 """Set the index of the DataFrame to be the keys columns. Note this means that the old index is removed. Parameters keys : str or list of str Which column(s) to set as the index. Returns ------- DataFrame DataFrame with the index set to the column(s) corresponding to the keys. """

        if isinstance(keys, str):
            column = self._data[keys]
            new_index = Index(column.values, column.dtype, column.name)

            new_data = OrderedDict((sr.name, Series(sr.values, new_index, sr.dtype, sr.name))
                                   for sr in self._iter())
            del new_data[keys]

            return DataFrame(new_data, new_index)
        elif isinstance(keys, list):
            check_inner_types(keys, str)

            new_index_data = []
            for column_name in keys:
                column = self._data[column_name]
                new_index_data.append(Index(column.values, column.dtype, column.name))
            new_index = MultiIndex(new_index_data, keys)

            new_data = OrderedDict((sr.name, Series(sr.values, new_index, sr.dtype, sr.name))
                                   for sr in self._iter())
            for column_name in keys:
                del new_data[column_name]

            return DataFrame(new_data, new_index)
        else:
            raise TypeError('Expected a string or a list of strings')