def get_playlist_id(playlist_name, client):
    """
    Get a playlist called playlist_name, if it doesn't exist it creates it
    """
    playlists = client.get_playlists()
    # Find any matches
    playlist = next((p for p in playlists['items'] if p['snippet']['title'] == playlist_name), None)
    if playlist is None:
        # Create if doesn't exist
        playlist = client.create_playlist(playlist_name)
    return playlist['id']