Creating Gradients Programmatically in Python