import re


def check_playlist_url(playlist_url):
    """Check if a playlist URL is well-formated.

    Parameters
    ----------
    playlist_url : str
        URL to a YouTube playlist.

    Returns
    -------
    str
        If the URL is well-formated, return the playlist ID. Else return `None`.

    """
    match = re.match(
        r"https?://www\.youtube\.com/playlist\?list=(.+)",
        playlist_url.strip()
    )
    if match is None:
        raise ValueError("Incorrect URL: %s" % playlist_url)
    return match.group(1)