Switch to the same base64 encoding as matplotlib.
Switch to the same base64 encoding as matplotlib.

Avoid an error about dictionary size changing during iteration.

donkirkby/live-py-plugin,brandm/live-py-plugin,donkirkby/live-py-plugin,brandm/live-py-plugin,donkirkby/live-py-plugin,donkirkby/live-py-plugin,brandm/live-py-plugin,donkirkby/live-py-plugin,brandm/live-py-plugin,brandm/live-py-plugin