code: def to_dict(self, model_index):
          
          return dict(
              name=self.name,
              model_index=model_index,
              model_name=self.model_name,
              model_version=self.version,
              has_output=self.output_created,
              dfile=self.as_dfile(),
              execution_halted=self.execution_halted,
              stdout=self.stdout,
              stderr=self.stderr,
              outfile=getattr(self, "outfile", None),
              output=getattr(self, "output", None),
              logic_bin=getattr(self, "logic_bin", None),
              logic_notes=getattr(self, "logic_notes", None),
              recommended=getattr(self, "recommended", None),
              recommended_variable=getattr(self, "recommended_variable", None),
          )
docs: Return a summary of the model in a dictionary format for serialization.
  
          Parameters
          ----------
          model_index : int
              The index of the model in a list of models, should be unique
  
          Returns
          -------
          out : dictionary
              A dictionary of model inputs, and raw and parsed outputs