def base64_b64encode(instr):
 if six.PY3:
  b = salt.utils.to_bytes(instr)
  b64 = base64.b64encode(b)
  return salt.utils.to_str(b64)
 return base64.b64encode(instr)

def base64_b64encode ( instr ) : if six . PY3 : b = salt . utils . to_bytes ( instr ) b64 = base64 . b64encode ( b ) return salt . utils . to_str ( b64 ) return base64 . b64encode ( instr )
encode a string as base64 using the "modern" python interface .