import re
import string


def uniformize_song_title(song_title: str) -> str:
    """Apply basic manual title uniformization transformations.

    .. note::
        This function is meant to be used in conjunction with
        :meth:`fuzzy_score` and can serve for a rough first filtering
        step.

    Parameters
    ----------
    song_title
        Song title.

    Returns
    -------
    :code:`str`
        Uniformized song title.
    """
    # Make everything lower case:
    uniformized_song_title = song_title.lower()
    # Remove bracket/brace content from the end of titles:
    uniformized_song_title = re.sub(
        r"((\s*\[[^]]*\])|(\s*\([^)]*\)))+$", "", uniformized_song_title
    )
    # Remove punctuation:
    uniformized_song_title = uniformized_song_title.translate(
        str.maketrans("", "", string.punctuation)
    )
    # Strip white-space:
    uniformized_song_title = uniformized_song_title.strip()

    return uniformized_song_title