python loop refactor
python loop refactor