Performance Optimization In Python