<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _on_motion(self, event):
 """Drag around label if visible."""

        if not self._visual_drag.winfo_ismapped():
            return

        if self._drag_cols and self._dragged_col is not None:
            self._drag_col(event)
        elif self._drag_rows and self._dragged_row is not None:
            self._drag_row(event)