Python Point Spread Function Optimization Theory And Practice