def base64_encodestring(instr):
    if six.PY3:
        b = salt.utils.to_bytes(instr)
        b64 = base64.encodebytes(b)
        return salt.utils.to_str(b64)
    return base64.encodestring(instr)
Encode a string as base64 using the "legacy" Python interface.
dataset/ETHPy150Open saltstack/salt/salt/modules/hashutil.py/base64_encodestring