wrote python script for advanced