<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def zoom_motion(self, event=None):
 """motion event handler for zoom mode"""

        try:
            x, y  = event.x, event.y
        except:
            return
        self.report_motion(event=event)
        if self.zoom_ini is None:
            return
        ini_x, ini_y, ini_xd, ini_yd = self.zoom_ini
        if event.xdata is not None:
            self.x_lastmove = event.xdata
        if event.ydata is not None:
            self.y_lastmove = event.ydata
        x0     = min(x, ini_x)
        ymax   = max(y, ini_y)
        width  = abs(x-ini_x)
        height = abs(y-ini_y)
        y0     = self.canvas.figure.bbox.height - ymax

        zdc = wx.ClientDC(self.canvas)
        zdc.SetLogicalFunction(wx.XOR)
        zdc.SetBrush(wx.TRANSPARENT_BRUSH)
        zdc.SetPen(wx.Pen('White', 2, wx.SOLID))
        zdc.ResetBoundingBox()
        if not is_wxPhoenix:
            zdc.BeginDrawing()

        # erase previous box
        if self.rbbox is not None:
            zdc.DrawRectangle(*self.rbbox)
        self.rbbox = (x0, y0, width, height)
        zdc.DrawRectangle(*self.rbbox)
        if not is_wxPhoenix:
            zdc.EndDrawing()