'Converts key into canonical form, converting integers or indexable
items into valid integers for self\'s range or returning slices
unchanged.
See Also
key2bounds'

def key2ij(self, key):

    if is_sequence(key):
        if (not (len(key) == 2)):
            raise TypeError('key    must    be    a    sequence    of    length    2')
        return [(a2idx(i, n) if (not isinstance(i, slice)) else i) for (i, n) in zip(key, self.shape)]
    elif isinstance(key, slice):
        return key.indices(len(self))[:2]
    else:
        return divmod(a2idx(key, len(self)), self.cols)
