python script to encode/decode image to base64 string and vise versa