<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def OnUpdate(self, event):
 """Menu state update"""


        if wx.ID_UNDO in self.id2menuitem:
            undo_item = self.id2menuitem[wx.ID_UNDO]
            undo_item.Enable(undo.stack().canundo())

        if wx.ID_REDO in self.id2menuitem:
            redo_item = self.id2menuitem[wx.ID_REDO]
            redo_item.Enable(undo.stack().canredo())

        event.Skip()