If you have a string that you want to convert to a python identifier, and have it respect the existing namespace and python and specified reserved words, here’s a function to do it:
https://gist.github.com/JamesPHoughton/3a3f87c6662bf5c9eccc9f2206e228fd