Wisdom 12:27

27 When they were punished with those creatures they considered gods, they became bitterly disillusioned and recognized that the true God was the one they had always refused to acknowledge. That is why they suffered the final punishment.

Wisdom 12:27 In-Context

25 And so you punished them for their stupidity, and your judgment made them look like fools.
26 It was a light punishment, but those who pay no attention to such warnings deserve to feel the full weight of God's judgment.
27 When they were punished with those creatures they considered gods, they became bitterly disillusioned and recognized that the true God was the one they had always refused to acknowledge. That is why they suffered the final punishment.
Scripture taken from the Good News Translation - Second Edition, Copyright 1992 by American Bible Society. Used by Permission.