<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encode_arc(self, coords):
 """ Appends commands to _geometry to create an arc. - Returns False if nothing was added - Returns True and moves _last_x, _last_y if some points where added """

        last_x, last_y = self._last_x, self._last_y
        float_x, float_y = next(coords)
        x, y = self.coords_on_grid(float_x, float_y)
        dx, dy = x - last_x, y - last_y
        cmd_encoded = encode_cmd_length(CMD_MOVE_TO, 1)
        commands = [cmd_encoded,
                    zigzag(dx),
                    zigzag(dy),
                    CMD_FAKE
                    ]
        pairs_added = 0
        last_x, last_y = x, y
        for float_x, float_y in coords:
            x, y = self.coords_on_grid(float_x, float_y)
            dx, dy = x - last_x, y - last_y
            if dx == 0 and dy == 0:
                continue
            commands.append(zigzag(dx))
            commands.append(zigzag(dy))
            last_x, last_y = x, y
            pairs_added += 1
        if pairs_added == 0:
            return False
        cmd_encoded = encode_cmd_length(CMD_LINE_TO, pairs_added)
        commands[3] = cmd_encoded
        self._geometry.extend(commands)
        self._last_x, self._last_y = last_x, last_y
        return True