import re


def _get_stage_next_free_path(stage, scene_path):
    """Get next free path in the stage."""
    default_prim = stage.GetDefaultPrim()
    if default_prim:
        scene_path = default_prim.GetPath().pathString + scene_path

    match = re.search(r'_(\d+)$', scene_path)
    i = int(match.group(1)) if match else 0

    while stage.GetPrimAtPath(scene_path):
        scene_path = f'{scene_path}_{i:02d}'

    return scene_path