def _swaplevel_columns(self, i: Union[(int, Name)], j: Union[(int, Name)]) -> InternalFrame:
    assert isinstance(self.columns, pd.MultiIndex)
    for index in (i, j):
        if ((not isinstance(index, int)) and (index not in self.columns.names)):
            raise KeyError(('Level %s not found' % index))
    i = (i if isinstance(i, int) else self.columns.names.index(i))
    j = (j if isinstance(j, int) else self.columns.names.index(j))
    for index in (i, j):
        if ((index >= len(self.columns)) or (index < (- len(self.columns)))):
            raise IndexError(('Too many levels: Columns have only %s levels, %s is not a valid level number' % (self._internal.index_level, index)))
    column_label_names = self._internal.column_label_names.copy()
    (column_label_names[i], column_label_names[j]) = (column_label_names[j], column_label_names[i])
    column_labels = self._internal._column_labels
    column_label_list = [list(label) for label in column_labels]
    for label_list in column_label_list:
        (label_list[i], label_list[j]) = (label_list[j], label_list[i])
    column_labels = [tuple(x) for x in column_label_list]
    internal = self._internal.copy(column_label_names=list(column_label_names), column_labels=list(column_labels))
    return internal
def _swaplevel_columns(self, i: Union[(int, Name)], j: Union[(int, Name)]) -> InternalFrame:
    assert isinstance(self.columns, pd.MultiIndex)
    for index in (i, j):
        if ((not isinstance(index, int)) and (index not in self.columns.names)):
            raise KeyError(('Level %s not found' % index))
    i = (i if isinstance(i, int) else self.columns.names.index(i))
    j = (j if isinstance(j, int) else self.columns.names.index(j))
    for index in (i, j):
        if ((index >= len(self.columns)) or (index < (- len(self.columns)))):
            raise IndexError(('Too many levels: Columns have only %s levels, %s is not a valid level number' % (self._internal.index_level, index)))
    column_label_names = self._internal.column_label_names.copy()
    (column_label_names[i], column_label_names[j]) = (column_label_names[j], column_label_names[i])
    column_labels = self._internal._column_labels
    column_label_list = [list(label) for label in column_labels]
    for label_list in column_label_list:
        (label_list[i], label_list[j]) = (label_list[j], label_list[i])
    column_labels = [tuple(x) for x in column_label_list]
    internal = self._internal.copy(column_label_names=list(column_label_names), column_labels=list(column_labels))
    return internal