you can consult this topic, should meet your expectations
edit: with Mr. Nick’s script and additional explanations on the modification according to the Python Engine Used (the names of the code blocks are important)
Cordially christian.stan