<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete(self):
 """Deletes a selection if any else deletes the cursor cell Refreshes grid after deletion """


        if self.grid.IsSelection():
            # Delete selection
            self.grid.actions.delete_selection()

        else:
            # Delete cell at cursor
            cursor = self.grid.actions.cursor
            self.grid.actions.delete_cell(cursor)

        # Update grid
        self.grid.ForceRefresh()