code: def fit_constrained_wrap(
      model, constraints, start_params=None, **fit_kwds
  ):
      """fit_constraint that returns a results instance
  
      This is a development version for fit_constrained methods or
      fit_constrained as standalone function.
  
      It will not work correctly for all models because creating a new
      results instance is not standardized for use outside the `fit` methods,
      and might need adjustements for this.
  
      This is the prototype for the fit_constrained method that has been added
      to Poisson and GLM.
      """
  
      self = model  # alias for use as method
  
      # constraints = (R, q)
      # TODO: temporary trailing underscore to not overwrite the monkey
      #       patched version
      # TODO: decide whether to move the imports
      from patsy import DesignInfo
  
      # we need this import if we copy it to a different module
      # from statsmodels.base._constraints import fit_constrained
      # same pattern as in base.LikelihoodModel.t_test
      lc = DesignInfo(self.exog_names).linear_constraint(constraints)
      R, q = lc.coefs, lc.constants
  
      # TODO: add start_params option, need access to tranformation
      #       fit_constrained needs to do the transformation
      params, cov, res_constr = fit_constrained(
          self, R, q, start_params=start_params, fit_kwds=fit_kwds
      )
      # create dummy results Instance, TODO: wire up properly
      res = self.fit(
          start_params=params, maxiter=0, warn_convergence=False
      )  # we get a wrapper back
      res._results.params = params
      res._results.cov_params_default = cov
      cov_type = fit_kwds.get("cov_type", "nonrobust")
      if cov_type == "nonrobust":
          res._results.normalized_cov_params = cov / res_constr.scale
      else:
          res._results.normalized_cov_params = None
  
      k_constr = len(q)
      res._results.df_resid += k_constr
      res._results.df_model -= k_constr
      res._results.constraints = LinearConstraints.from_patsy(lc)
      res._results.k_constr = k_constr
      res._results.results_constrained = res_constr
      return res
  
file_path: statsmodels/statsmodels/base/_constraints.py
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: fit_constrained_wrap(model, constraints, start_params) and returns: res