<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cmd_z(self, lvl=None, ch=None):
 """z lvl=level ch=chname Zoom the image for the given viewer/channel to the given zoom level. Levels can be positive or negative numbers and are relative to a scale of 1:1 at zoom level 0. """

        viewer = self.get_viewer(ch)
        if viewer is None:
            self.log("No current viewer/channel.")
            return

        cur_lvl = viewer.get_zoom()

        if lvl is None:
            self.log("zoom=%f" % (cur_lvl))

        else:
            viewer.zoom_to(lvl)