@cvp, my intention was to do as much as possible in Pythonista, since I find Shortcuts so slow. Your question got me to think and I went with your suggestion instead. 🙂 Also, I already had a shortcut that did most of what I wanted.
@mikael, thanks for suggesting tobytes. I will try to keep that in mind for another time. 🙂