python code for report automation