import base64

img_data = b"<base64 here>"

with open("imageToSave.jpg", "wb") as fh:
    fh.write(base64.decodebytes(img_data))

a9f67dffdfba590ec804b97cc08f86bcfc6c0a27
<mask token>

<mask token>
with open('imageToSave.jpg', 'wb') as fh:
    fh.write(base64.decodebytes(img_data))

<mask token>
img_data = b'<base64 here>'
with open('imageToSave.jpg', 'wb') as fh:
    fh.write(base64.decodebytes(img_data))

import base64
img_data = b'<base64 here>'
with open('imageToSave.jpg', 'wb') as fh:
    fh.write(base64.decodebytes(img_data))

import base64

img_data = b"<base64 here>"

with open("imageToSave.jpg", "wb") as fh:
    fh.write(base64.decodebytes(img_data))
