rewrote petal in python