This is in Anguttara Nikaya, 4.49:
"These four, [that follow, below] O Monks, are distortions of perception, distortions of thought, distortions of view:
 Sensing no change in the changing,
 Sensing pleasure in suffering,
 Assuming self where there is no self,
 Sensing the unlovely as lovely—
Gone astray with wrong views, beings
Misperceive with distorted minds.
Bound in the bondage of Mara,
Those people are far from safety.
They’re beings that go on flowing:
Going again from death to birth.
But when in the world of darkness
Buddhas arise to make things bright,
They present this profound teaching
Which brings suffering to an end.
When those with wisdom have heard this,
They recuperate their right mind:
They see change in what is changing,
Suffering where there’s suffering,
“Non-self” in what is without self,
They see the unlovely as such.
By this acceptance of right view,That is the Anguttara Nikaya’s Vipallasa Sutta, or the distortions of perception, thought, and view.
They overcome all suffering.”