EN
We extend a remarkable theorem of Derdziński and Shen, on the restrictions imposed on the Riemann tensor by the existence of a nontrivial Codazzi tensor. We show that the Codazzi equation can be replaced by a more general algebraic condition. The resulting extension applies both to the Riemann tensor and to generalized curvature tensors.