def handle_command(self, command, coord_string):
    isLower = command.islower()
    command = command.upper()
    points = self.points
    new_points = self.string_to_points(coord_string)
    if (isLower and (len(points) > 0)):
        new_points += points[(- 1)]
    if (command == 'M'):
        self.start_new_path(new_points[0])
        if (len(new_points) <= 1):
            return
        points = self.points
        new_points = new_points[1:]
        command = 'L'
        for p in new_points:
            if isLower:
                p[0] += self.points[((- 1), 0)]
                p[1] += self.points[((- 1), 1)]
            self.add_line_to(p)
        return
    elif (command in ['L', 'H', 'V']):
        if (command == 'H'):
            new_points[(0, 1)] = points[((- 1), 1)]
        elif (command == 'V'):
            if isLower:
                new_points[(0, 0)] -= points[((- 1), 0)]
                new_points[(0, 0)] += points[((- 1), 1)]
            new_points[(0, 1)] = new_points[(0, 0)]
            new_points[(0, 0)] = points[((- 1), 0)]
        self.add_line_to(new_points[0])
        return
    if (command == 'C'):
        pass
    elif (command in ['S', 'T']):
        self.add_smooth_curve_to(*new_points)
        return
    elif (command == 'Q'):
        new_points = np.append([new_points[0]], new_points, axis=0)
    elif (command == 'A'):
        raise Exception('Not implemented')
    elif (command == 'Z'):
        return
    self.add_cubic_bezier_curve_to(*new_points[0:3])
    if (len(new_points) > 3):
        for i in range(3, len(new_points), 3):
            if isLower:
                new_points[i:(i + 3)] -= points[(- 1)]
                new_points[i:(i + 3)] += new_points[(i - 1)]
            self.add_cubic_bezier_curve_to(*new_points[i:(i + 3)])
def handle_command(self, command, coord_string):
    isLower = command.islower()
    command = command.upper()
    points = self.points
    new_points = self.string_to_points(coord_string)
    if (isLower and (len(points) > 0)):
        new_points += points[(- 1)]
    if (command == 'M'):
        self.start_new_path(new_points[0])
        if (len(new_points) <= 1):
            return
        points = self.points
        new_points = new_points[1:]
        command = 'L'
        for p in new_points:
            if isLower:
                p[0] += self.points[((- 1), 0)]
                p[1] += self.points[((- 1), 1)]
            self.add_line_to(p)
        return
    elif (command in ['L', 'H', 'V']):
        if (command == 'H'):
            new_points[(0, 1)] = points[((- 1), 1)]
        elif (command == 'V'):
            if isLower:
                new_points[(0, 0)] -= points[((- 1), 0)]
                new_points[(0, 0)] += points[((- 1), 1)]
            new_points[(0, 1)] = new_points[(0, 0)]
            new_points[(0, 0)] = points[((- 1), 0)]
        self.add_line_to(new_points[0])
        return
    if (command == 'C'):
        pass
    elif (command in ['S', 'T']):
        self.add_smooth_curve_to(*new_points)
        return
    elif (command == 'Q'):
        new_points = np.append([new_points[0]], new_points, axis=0)
    elif (command == 'A'):
        raise Exception('Not implemented')
    elif (command == 'Z'):
        return
    self.add_cubic_bezier_curve_to(*new_points[0:3])
    if (len(new_points) > 3):
        for i in range(3, len(new_points), 3):
            if isLower:
                new_points[i:(i + 3)] -= points[(- 1)]
                new_points[i:(i + 3)] += new_points[(i - 1)]
            self.add_cubic_bezier_curve_to(*new_points[i:(i + 3)])