def scale_outline(ai_outline_list, ai_coef):
    """ apply the scale coefficient to a list of outlines
  """
    lx, kx, ly, ky = ai_coef
    r_outline_list = []
    for outline in ai_outline_list:
        outline_type = outline[0]
        if outline_type == 'graphic_lines' or outline_type == 'overlay_lines':
            lines = outline[1]
            new_lines = []
            for line in lines:
                new_line = []
                for i in range(len(line) / 2):
                    new_line.append(line[2 * i] * lx + kx)
                    new_line.append(line[2 * i + 1] * ly + ky)
                new_lines.append(tuple(new_line))
            r_outline_list.append((outline_type, tuple(new_lines), outline[
                2], outline[3]))
        elif outline_type == 'graphic_polygon' or outline_type == 'overlay_polygon':
            points = outline[1]
            new_points = []
            for i in range(len(points) / 2):
                new_points.append(points[2 * i] * lx + kx)
                new_points.append(points[2 * i + 1] * ly + ky)
            r_outline_list.append((outline_type, tuple(new_points), outline
                [2], outline[3], outline[4]))
    return r_outline_list
