I think there is may be a more concise way to do this:
```
nd = 0
for v in index:
    if v is not Ellipsis:
        nd += 1
if nd != len(index):
    new_index = ()
    for v in index:
        if v is Ellipsis:
            new_index = new_index + (slice(None),)*(max(0, 2 - len(new_index)
    index = new_index
```
i.e. use the logic "the first Ellipsis from the left expands to : matching the dimensions".