<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert(self, caffemodel_path, outmodel_path):
 """Convert a Caffe .caffemodel file to MXNet .params file"""

        net_param = caffe_pb2.NetParameter()
        with open(caffemodel_path, 'rb') as caffe_model_file:
            net_param.ParseFromString(caffe_model_file.read())

        layers = net_param.layer
        self.layers = layers

        for idx, layer in enumerate(layers):
            layer_name = str(layer.name)

            if layer.blobs:

                # If this is a layer that has only weight and bias as parameter
                if layer.type == 'Convolution' or layer.type == 'InnerProduct' \
                        or layer.type == 'Deconvolution':

                    # Add weight and bias to the dictionary
                    self.add_arg_param('%s_weight' % layer_name, layer_index=idx, blob_index=0)
                    self.add_optional_arg_param('%s_bias' % layer_name, layer_index=idx,
                                                blob_index=1)

                elif layer.type == 'BatchNorm':

                    gamma_param_name = '%s_gamma' % layer_name
                    beta_param_name = '%s_beta' % layer_name

                    next_layer = layers[idx + 1]

                    if next_layer.type == 'Scale':
                        # If next layer is scale layer, get gamma and beta from there
                        self.add_arg_param(gamma_param_name, layer_index=idx+1, blob_index=0)
                        self.add_arg_param(beta_param_name, layer_index=idx+1, blob_index=1)

                    mean_param_name = '%s_moving_mean' % layer_name
                    var_param_name = '%s_moving_var' % layer_name

                    self.add_aux_param(mean_param_name, layer_index=idx, blob_index=0)
                    self.add_aux_param(var_param_name, layer_index=idx, blob_index=1)

                elif layer.type == 'Scale':

                    prev_layer = layers[idx - 1]

                    if prev_layer.type == 'BatchNorm':
                        continue
                    else:
                        # Use the naming convention used by CaffeOp
                        self.add_arg_param('%s_0_weight' % layer_name, layer_index=idx,
                                           blob_index=0)
                        self.add_optional_arg_param('%s_1_bias' % layer_name,
                                                    layer_index=idx, blob_index=1)

        mx.nd.save(outmodel_path, self.dict_param)