<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_drawn_rect(self, grid, key, rect):
 """Replaces drawn rect if the one provided by wx is incorrect This handles merged rects including those that are partly off screen. """


        rect = self.get_merged_rect(grid, key, rect)
        if rect is None:
            # Merged cell is drawn
            if grid.is_merged_cell_drawn(key):
                # Merging cell is outside view
                row, col, __ = key = self.get_merging_cell(grid, key)
                rect = grid.CellToRect(row, col)
                rect = self.get_merged_rect(grid, key, rect)
            else:
                return

        return rect