# Buggy code
async def convert(self, ctx: commands.Context, arg: str) -> MutableMapping:
    global_matches = await get_all_playlist_converter(
        PlaylistScope.GLOBAL.value, _bot, arg, guild=ctx.guild, author=ctx.author
    )
    guild_matches = await get_all_playlist_converter(
        PlaylistScope.GUILD.value, _bot, arg, guild=ctx.guild, author=ctx.author
    )
    user_matches = await get_all_playlist_converter(
        PlaylistScope.USER.value, _bot, arg, guild=ctx.guild, author=ctx.author
    )
    if not user_matches and not guild_matches and not global_matches:
        raise commands.BadArgument(_("Could not match '{}' to a playlist.").format(arg))
    return {
        PlaylistScope.GLOBAL.value: global_matches,
        PlaylistScope.GUILD.value: guild_matches,
        PlaylistScope.USER.value: user_matches,
        "all": [*global_matches, *guild_matches, *user_matches],
        "arg": arg,
    }


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/bot/botenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 83, in wrapped
ret = await coro(*args, **kwargs)
File "/home/bot/botenv/lib/python3.8/site-packages/redbot/cogs/audio/audio.py", line 4937, in _playlist_list
playlists = await get_all_playlist(scope, self.bot, guild, author, specified_user)
File "/home/bot/botenv/lib/python3.8/site-packages/redbot/cogs/audio/playlists.py", line 475, in get_all_playlist
scope_standard, scope_id = _prepare_config_scope(scope, author, guild)
File "/home/bot/botenv/lib/python3.8/site-packages/redbot/cogs/audio/playlists.py", line 86, in _prepare_config_scope
scope = standardize_scope(scope)
File "/home/bot/botenv/lib/python3.8/site-packages/redbot/cogs/audio/playlists.py", line 62, in standardize_scope
scope = scope.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

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

Traceback (most recent call last):
File "/home/bot/botenv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "/home/bot/botenv/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 799, in invoke
await super().invoke(ctx)
File "/home/bot/botenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1234, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/home/bot/botenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 797, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/bot/botenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 92, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'upper'

# Fixed code
async def convert(self, ctx: commands.Context, arg: str) -> MutableMapping:
    """Get playlist for all scopes that match the argument user provided"""
    cog = ctx.cog
    user_matches = []
    guild_matches = []
    global_matches = []
    if cog:
        global_matches = await get_all_playlist_converter(
            PlaylistScope.GLOBAL.value,
            ctx.bot,
            cog.playlist_api,
            arg,
            guild=ctx.guild,
            author=ctx.author,
        )
        guild_matches = await get_all_playlist_converter(
            PlaylistScope.GUILD.value,
            ctx.bot,
            cog.playlist_api,
            arg,
            guild=ctx.guild,
            author=ctx.author,
        )
        user_matches = await get_all_playlist_converter(
            PlaylistScope.USER.value,
            ctx.bot,
            cog.playlist_api,
            arg,
            guild=ctx.guild,
            author=ctx.author,
        )
    if not user_matches and not guild_matches and not global_matches:
        raise commands.BadArgument(_("Could not match '{}' to a playlist.").format(arg))
    return {
        PlaylistScope.GLOBAL.value: global_matches,
        PlaylistScope.GUILD.value: guild_matches,
        PlaylistScope.USER.value: user_matches,
        "all": [*global_matches, *guild_matches, *user_matches],
        "arg": arg,
    }