Narrated Abu Huraira
Allah's Messenger (ﷺ) said, "May Allah bestow His Mercy on Lot. He wanted to have a powerful support. If I were to stay in prison (for a period equal to) the stay of Joseph (prison) and then the offer of freedom came to me, then I would have accepted it." (See Hadith No. 591)