Use string formatting in expression generator python script