<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _store_optional_parameters(self, optional_params, name_list_attr, default_name_str, all_names, all_params, param_attr_name, series_name):
 """ Extract the optional parameters from the `results_dict`, save them to the model object, and update the list of all parameters and all parameter names. Parameters optional_params : 1D ndarray. The optional parameters whose values and names should be stored. name_list_attr : str. The attribute name on the model object where the names of the optional estimated parameters will be stored (if they exist). default_name_str : str. The name string that will be used to create generic names for the estimated parameters, in the event that the estimated parameters do not have names that were specified by the user. Should contain empty curly braces for use with python string formatting. all_names : list of strings. The current list of the names of the estimated parameters. The names of these optional parameters will be added to the beginning of this list. all_params : list of 1D ndarrays. Each array is a set of estimated parameters. The current optional parameters will be added to the beginning of this list. param_attr_name : str. The attribute name that will be used to store the optional parameter values on the model object. series_name : str. The string that will be used as the name of the series that contains the optional parameters. Returns ------- (all_names, all_params) : tuple. """

        # Identify the number of optional parameters
        num_elements = optional_params.shape[0]

        # Get the names of the optional parameters
        parameter_names = getattr(self, name_list_attr)
        if parameter_names is None:
            parameter_names = [default_name_str.format(x) for x in
                               range(1, num_elements + 1)]

        # Store the names of the optional parameters in all_names
        all_names = list(parameter_names) + list(all_names)
        # Store the values of the optional parameters in all_params
        all_params.insert(0, optional_params)

        # Store the optional parameters on the model object
        self._store_inferential_results(optional_params,
                                        index_names=parameter_names,
                                        attribute_name=param_attr_name,
                                        series_name=series_name)
        return all_names, all_params