from typing import List
from typing import Any
from typing import Tuple
import re


def fix_discogs_artist_name(artists: List[Any]) -> Tuple[str, str]:
    """Fixes names if there are duplicates on Discogs.
    Discogs lists some artists with parens after their name to prevent duplicates."""
    artist_ids = [str(a.id) for a in artists if a.id != 0]
    artists_names = [str(a.name) for a in artists]
    artist_fixed_names = [
        re.sub(r"\(\d+\)$", "", name).strip() for name in artists_names
    ]
    return ", ".join(artist_fixed_names), "|".join(artist_ids)