from pathlib import Path


def avoid_conflict(path: Path) -> Path:
    """Add an underscore if path is already a directory."""
    if path.is_dir():
        return avoid_conflict(path.parent / Path('_' + path.name))

    else:
        return path