import base64


def base64_encode(bot, trigger):
    """Encodes a message into base64."""
    if not trigger.group(2):
        return bot.reply('I need something to encode.')

    encodedBytes = base64.b64encode(trigger.group(2).encode('utf-8'))
    encodedStr = str(encodedBytes, 'utf-8')

    bot.say(encodedStr)