code: def split_param_vec(all_params, rows_to_nests, return_all_types=False):
      
      # Split the array of all coefficients
      num_nests = rows_to_nests.shape[1]
      orig_nest_coefs = all_params[:num_nests]
      index_coefs = all_params[num_nests:]
  
      if return_all_types:
          return orig_nest_coefs, None, None, index_coefs
      else:
          return orig_nest_coefs, index_coefs
docs: Parameters
      ----------
      all_params : 1D ndarray.
          Should contain all of the parameters being estimated (i.e. all the
          nest coefficients and all of the index coefficients). All elements
          should be ints, floats, or longs.
      rows_to_nests : 2D scipy sparse array.
          There should be one row per observation per available alternative and
          one column per nest. This matrix maps the rows of the design matrix to
          the unique nests (on the columns).
      return_all_types : bool, optional.
          Determines whether or not a tuple of 4 elements will be returned (with
          one element for the nest, shape, intercept, and index parameters for
          this model). If False, a tuple of 2 elements will be returned, as
          described below. The tuple will contain the nest parameters and the
          index coefficients.
  
      Returns
      -------
      orig_nest_coefs : 1D ndarray.
          The nest coefficients being used for estimation. Note that these values
          are the logit of the inverse of the scale parameters for each lower
          level nest.
      index_coefs : 1D ndarray.
          The coefficients of the index being used for this nested logit model.
  
      Note
      ----
      If `return_all_types == True` then the function will return a tuple of four
      objects. In order, these objects will either be None or the arrays
      representing the arrays corresponding to the nest, shape, intercept, and
      index parameters.