changed python script to escape strings