def METHOD_NAME(grid, key):
    nd = grid.nd
    list_types = [numpy.ndarray, list]
    # l[pos]
    if any([isinstance(key, t) for t in list_types]):
        return key, None
    # all other keys need to be a tuple
    assert type(key) == tuple
    # strip positions
    if any([isinstance(key[0], t) for t in list_types]):
        # l[pos,...]
        pos = key[0]
        key = key[1:]
    else:
        # l[x,y,z,...]
        assert len(key) >= nd
        pos = key[:nd]
        key = key[nd:]
    # l[...,tidx]
    if len(key) == 1 and any([isinstance(key[0], t) for t in list_types]):
        tidx = key[0]
    # l[...,i0,i1,...]
    elif key == ():
        tidx = None
    else:
        tidx = key
    return pos, tidx