def _index(i, size, Cartesian=True):
    """If Cartesian=True, index 0 is swapped with index 1."""
    if Cartesian:
        if i == 1:
            return 0
        if i == 0:
            if size >= 2:
                return 1
    return i