To expand on the comment from Stephen Emslie, in Python 3 this works and is less code:
data="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUAAAhwAAAFoCAYAAAA......."
response = urllib.request.urlopen(data)
with open('image.jpg', 'wb') as f:
f.write(response.file.read())