Add support for for loops in python interpreter
# What does this PR do?

For loops are safe to execute in our restricted Python interpreter, this PR adds support for it and adds `range` in the list of base Python tools allowed.

Fixes #24362
_The documentation is not available anymore as the PR was closed or merged._