def _axis2words(self, arg, axis):
        res = []
        blank2word = []

        if isinstance(arg, IndexMatrix):
            if axis == 0:
                return arg.row2word
            elif axis == 1:
                return arg.col2word
            else:
                raise ValueError("Axis must be 0 or 1.")

        if axis == 0:
            blank2word = self.row2word
        elif axis == 1:
            blank2word = self.col2word
        else:
            raise ValueError("Axis must be 0 or 1.")

        if isinstance(arg, slice):
            res = blank2word[arg]
        elif isinstance(arg, str):
            res = [arg]
        elif isinstance(arg, Integral):
            res = [blank2word[arg]]
        elif type(arg) in (list, np.ndarray):
            for i, content in enumerate(arg):
                if type(content) in (bool, np.bool_) and content:  # Convert boolean lists to words
                    res.append(blank2word[i])
                elif isinstance(content, str):
                    res.append(content)
                elif isinstance(content, Integral) and not isinstance(content, bool):  # Convert indices to words. The
                    res.append(blank2word[content])
        else:
            raise TypeError("This type is not supported for indexing")
        return res
Returns a word representation of a given axis.
dataset/ETHPy150Open jimmycallin/pydsm/pydsm/indexmatrix.py/IndexMatrix._axis2words