Muwatta Imam Malik Book of I'tikaf in Ramadan, Hadith 9
Ziyad related to me from Malik from Ibn Shihab that the Messenger of Allah ﷺ used to go to relieve himself in houses.
Malik said, "Someone doing itikaf should not leave for his parents' funeral or for anything else."
وَحَدَّثَنِي زِيَادٌ، عَنْ مَالِكٍ، عَنِ ابْنِ شِهَابٍ، . أَنَّ رَسُولَ اللَّهِ ﷺ كَانَ يَذْهَبُ لِحَاجَةِ الإِنْسَانِ فِي الْبُيُوتِ . قَالَ مَالِكٌ لاَ يَخْرُجُ الْمُعْتَكِفُ مَعَ جَنَازَةِ أَبَوَيْهِ وَلاَ مَعَ غَيْرِهَا .