<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def OnPaste(self, event):
 """Clipboard paste event handler"""


        data = self.main_window.clipboard.get_clipboard()

        focus = self.main_window.FindFocus()

        if isinstance(focus, wx.TextCtrl):
            # Paste into TextCtrl if in focus
            focus.WriteText(data)

        else:
            # We got a grid selection
            key = self.main_window.grid.actions.cursor

            with undo.group(_("Paste")):
                self.main_window.actions.paste(key, data)

        self.main_window.grid.ForceRefresh()

        event.Skip()