import base64


def base64_encode(content, encoding='utf-8'):
    """
    b64encode wrapper to work with str objects instead of bytes
    base64.b64encode requires a bytes object (not a str), and returns a bytes object (not a str)
    for JSON serialization we want str
    :param content: string to base64-encode
    :param encoding: encoding of the input string
    :return: base64-encoded string using utf-8 encoding

    """
    return base64.b64encode(content.encode(encoding)).decode()