def METHOD_NAME(old_index, old_name, new_name):
    changed = False
    new_indexes = []
    if isinstance(old_index, list):
        for pngname in old_index:
            if isinstance(pngname, dict):
                sprite_ids = pngname.get("sprite")
                new_sprites = []
                if isinstance(sprite_ids, list):
                    for sprite_id in sprite_ids:
                        if sprite_id == old_name:
                            new_sprites.append(new_name)
                            changed = True
                        else:
                            new_sprites.append(sprite_id)
                    if new_sprites:
                        pngname["sprite"] = new_sprites
                elif sprite_ids == old_name:
                    pngname["sprite"] = new_name
                    changed = True
                else:
                    pngname["sprite"] = sprite_ids
                new_indexes.append(pngname)
            elif pngname == old_name:
                new_indexes.append(new_name)
                changed = True
            else:
                new_indexes.append(pngname)
    elif old_index == old_name:
        new_indexes.append(new_name)
        changed = True
    else:
        new_indexes.append(old_index)
    if new_indexes and len(new_indexes) == 1:
        return new_indexes[0], changed
    return new_indexes, changed