code: def test_status_fail_tpe():
      trials = Trials()
  
      argmin = fmin(
          fn=lambda x: (
              {"loss": (x - 3) ** 2, "status": STATUS_OK}
              if (x < 0)
              else {"status": STATUS_FAIL}
          ),
          space=hp.uniform("x", -5, 5),
          algo=tpe.suggest,
          max_evals=50,
          trials=trials,
      )
  
      assert len(trials) == 50, len(trials)
      assert argmin["x"] < 0, argmin
      assert "loss" in trials.best_trial["result"], (
          "loss" in trials.best_trial["result"]
      )
      assert (
          trials.best_trial["result"]["loss"] >= 9
      ), trials.best_trial["result"]["loss"]
  
imports: import unittest
  import numpy
  from timeit import default_timer
  import time
  from hyperopt.early_stop import no_progress_loss
  from hyperopt.fmin import generate_trials_to_calculate
  import pytest
  from hyperopt import fmin, rand, tpe, hp, Trials, exceptions, space_eval, STATUS_FAIL, STATUS_OK
  from hyperopt.base import JOB_STATE_ERROR
label_desc: Use image node_id 8 for calling a global function with example usage: test_status_fail_tpe() without return types