<prompt> Kuandika kazi ya kutatua tatizo zifuatazo programu: Kutokana na mizizi ya miti miwili binary p na q, kuandika kazi ya kuangalia kama wao ni sawa au la. miti miwili binary ni kuchukuliwa sawa kama wao ni muundo sawa, na nodes kuwa na thamani sawa.  <response>: Here is a Python function that can solve the problem:def is_same_treep, q: if not p and not q: return True if not p or not q: return False if p.val ! q.val: return False return is_same_treep.left, q.left and is_same_treep.right, q.rightIn this function, we check the base cases where both trees are empty or one of them is empty. Then we check if both roots have the same value. Finally, we recursively check if both left and right subtrees are the same. If all conditions are met, we return True, otherwise we return False. 