A common idiom in CPython to ensure thread safety for iteration is using tuple().
tuple()
For example - tuple(dict.items()) is guaranteed to be threadsa
tuple(dict.items())