code: def test_save_load_modelresult(dill):
      """Save/load ModelResult with/without dill."""
      if dill:
          pytest.importorskip("dill")
      else:
          lmfit.jsonutils.HAS_DILL = False
  
      # create model, perform fit, save ModelResult and perform some tests
      model, params = create_model_params(x, y)
      result = model.fit(y, params, x=x)
      save_modelresult(result, SAVE_MODELRESULT)
  
      file_exists = wait_for_file(SAVE_MODELRESULT, timeout=10)
      assert file_exists
  
      text = ""
      with open(SAVE_MODELRESULT) as fh:
          text = fh.read()
      assert (
          12000 < len(text) < 60000
      )  # depending on whether dill is present
  
      # load the saved ModelResult from file and compare results
      result_saved = load_modelresult(SAVE_MODELRESULT)
      assert result_saved.residual is not None
      check_fit_results(result_saved)
  
      clear_savefile(SAVE_MODEL)
  
imports: import json
  import os
  import time
  import numpy
  from numpy.testing import assert_allclose
  import pytest
  from lmfit import Parameters
  import lmfit.jsonutils
  from lmfit.lineshapes import gaussian, lorentzian
  from lmfit.model import Model, ModelResult, load_model, load_modelresult, save_model, save_modelresult
  from lmfit.models import ExponentialModel, ExpressionModel, GaussianModel, VoigtModel
label_desc: Use image node_id 6 for calling a global function with example usage: test_save_load_modelresult(dill) without return types