Python 3 now handles str and bytes differently to Python 2, so when
using b64encode/decode, the input and output must specifically by
bytes.
This commit adds some base64 helpers to coerce the input to become
bytes if the input is a str and decodes the output back to str after
the encode or decode.
It also adds a test case to replicate the issue and cover the new
functions.
Change-Id: I8f64da03c7cfc76e620cb3b98201f6287b752bb3