<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_scale(self, name, W, b, has_bias, input_name, output_name, shape_scale = [1], shape_bias = [1]):
 """ Add scale layer to the model. Parameters name: str The name of this layer. W: int | numpy.array Scale of the input. b: int | numpy.array Bias to add to the input. has_bias: boolean Whether the bias vector of this layer is ignored in the spec. input_name: str The input blob name of this layer. output_name: str The output blob name of this layer. shape_scale: [int] List of ints that specifies the shape of the scale parameter. Can be [1] or [C] or [1,H,W] or [C,H,W]. shape_bias: [int] List of ints that specifies the shape of the bias parameter (if present). Can be [1] or [C] or [1,H,W] or [C,H,W]. See Also -------- add_bias """

        spec = self.spec
        nn_spec = self.nn_spec

        spec_layer = nn_spec.layers.add()
        spec_layer.name = name
        spec_layer.input.append(input_name)
        spec_layer.output.append(output_name)
        spec_layer_params = spec_layer.scale

        spec_layer_params.hasBias = has_bias

        #add scale and its shape
        scale = spec_layer_params.scale
        spec_layer_params.shapeScale.extend(shape_scale)
        if isinstance(W, int):
            scale.floatValue.append(float(W))
        else:
            scale.floatValue.extend(map(float, W.flatten()))
        if len(scale.floatValue) != np.prod(shape_scale):
            raise ValueError("Dimensions of 'shape_scale' do not match the size of the provided 'scale' parameter")

        #add bias and its shape
        if has_bias:
            bias = spec_layer_params.bias
            spec_layer_params.shapeBias.extend(shape_bias)
            if isinstance(b, int):
                bias.floatValue.append(float(b))
            else:
                bias.floatValue.extend(map(float, b.flatten()))
            if len(bias.floatValue) != np.prod(shape_bias):
                raise ValueError("Dimensions of 'shape_bias' do not match the size of the provided 'b' parameter")