Allah's Messenger (ﷺ) said, "Some poetry contains wisdom."

Sahih al-Bukhari Book 78, Hadith 171