Preprocess Text Function Python Syntax For Loop