discord.py check if user has role

    @bot.command(pass_context=True)
    @commands.has_role("Admin")
    async def unmute(ctx, user: discord.Member):
        role = discord.utils.find(lambda r: r.name == 'Member', ctx.message.server.roles)
        if role in user.roles:
            await bot.say("{} is not muted".format(user))
        else:
            await bot.add_roles(user, role)

Here is what the above code is Doing:
1. Defines a command called ‘mute’
2. Requires the user to have the ‘Admin’ role
3. Takes a user as an argument
4. Finds the ‘Member’ role
5. Checks if the user has the ‘Member’ role
6. If they don’t have the ‘Member’ role, it adds it to them
7. If they do have the ‘Member’ role, it tells them they’re not muted