Generalized equation of state for dark energy