# Buggy code
async def from_json(
    cls, bot: Red, scope: str, playlist_number: int, data: dict, **kwargs
):
    """Get a Playlist object from the provided information.
    Parameters
    ----------
    bot: Red
        The bot's instance. Needed to get the target user.
    scope:str
        The custom config scope. One of 'GLOBALPLAYLIST', 'GUILDPLAYLIST' or 'USERPLAYLIST'.
    playlist_number: int
        The playlist's number.
    data: dict
        The JSON representation of the playlist to be gotten.
    **kwargs
        Extra attributes for the Playlist instance which override values
        in the data dict. These should be complete objects and not
        IDs, where possible.
    Returns
    -------
    Playlist
        The playlist object for the requested playlist.
    Raises
    ------
    `InvalidPlaylistScope`
        Passing a scope that is not supported.
    `MissingGuild`
        Trying to access the Guild scope without a guild.
    `MissingAuthor`
        Trying to access the User scope without an user id.
    """
    guild = data.get("guild") or kwargs.get("guild")
    author = data.get("author")
    playlist_id = data.get("id") or playlist_number
    name = data.get("name", "Unnamed")
    playlist_url = data.get("playlist_url", None)
    tracks = data.get("tracks", [])

    return cls(
        bot=bot,
        guild=guild,
        scope=scope,
        author=author,
        playlist_id=playlist_id,
        name=name,
        playlist_url=playlist_url,
        tracks=tracks,
    )


# Traceback (RuntimeError)
Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3183, in play
await self._enqueue_tracks(ctx, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/audio.py", line 3885, in _enqueue_tracks
result, called_api = await self.music_cache.lavalink_query(ctx, player, query)
File "/home/martinebots/martinebotscogs/cogs_modified/audio/apis.py", line 911, in lavalink_query
results = await player.load_tracks(query)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 300, in load_tracks
self.__check_node_ready()
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/lavalink/rest_api.py", line 268, in __check_node_ready
raise RuntimeError("Cannot execute REST request when node not ready.")
RuntimeError: Cannot execute REST request when node not ready.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 728, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/martinebots/martinebotsvenv/lib/python3.7/site-packages/discord/ext/commands/core.py", line 88, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: Cannot execute REST request when node not ready.```

# Fixed code
async def from_json(
    cls, bot: Red, scope: str, playlist_number: int, data: PlaylistFetchResult, **kwargs
) -> "Playlist":
    """Get a Playlist object from the provided information.
    Parameters
    ----------
    bot: Red
        The bot's instance. Needed to get the target user.
    scope:str
        The custom config scope. One of 'GLOBALPLAYLIST', 'GUILDPLAYLIST' or 'USERPLAYLIST'.
    playlist_number: int
        The playlist's number.
    data: dict
        The JSON representation of the playlist to be gotten.
    **kwargs
        Extra attributes for the Playlist instance which override values
        in the data dict. These should be complete objects and not
        IDs, where possible.
    Returns
    -------
    Playlist
        The playlist object for the requested playlist.
    Raises
    ------
    `InvalidPlaylistScope`
        Passing a scope that is not supported.
    `MissingGuild`
        Trying to access the Guild scope without a guild.
    `MissingAuthor`
        Trying to access the User scope without an user id.
    """
    guild = data.scope_id if scope == PlaylistScope.GUILD.value else kwargs.get("guild")
    author = data.author_id
    playlist_id = data.playlist_id or playlist_number
    name = data.playlist_name
    playlist_url = data.playlist_url
    tracks = data.tracks

    return cls(
        bot=bot,
        guild=guild,
        scope=scope,
        author=author,
        playlist_id=playlist_id,
        name=name,
        playlist_url=playlist_url,
        tracks=tracks,
    )