code: def naturalize_nest_coefs(nest_coef_estimates):
      
      # Calculate the exponential term of the
      # logistic transformation
      exp_term = np.exp(-1 * nest_coef_estimates)
  
      # Guard against_overflow
      inf_idx = np.isinf(exp_term)
      exp_term[inf_idx] = max_comp_value
  
      # Calculate the 'natural' nest coefficients
      nest_coefs = 1.0 / (1.0 + exp_term)
  
      # Guard against underflow
      zero_idx = (nest_coefs == 0)
      nest_coefs[zero_idx] = min_comp_value
  
      return nest_coefs
docs: Parameters
      ----------
      nest_coef_estimates : 1D ndarray.
          Should contain the estimated logit's
          (`ln[nest_coefs / (1 - nest_coefs)]`) of the true nest coefficients.
          All values should be ints, floats, or longs.
  
      Returns
      -------
      nest_coefs : 1D ndarray.
          Will contain the 'natural' nest coefficients:
          `1.0 / (1.0 + exp(-nest_coef_estimates))`.