This part isn't an actual answer, however, since I don't have 50 reputation yet, I can't add a comment. I think the most recent answer (besides mine) is obviously, so obviously an AI - generated answer, so could someone please flag user20275214's answer? Examples of AI: 'Without seeing the code', 'assistance', these are all stupid. The code has been provided, and it is very clear that you didn't paste the code in. ;-;
You should try converting the 'None' type into a string object, if you haven't already, or debugging it by printing it out at some steps.