code: def validate_trial_results(results, objective, func_name):
      if isinstance(results, list):
          for elem in results:
              validate_trial_results(elem, objective, func_name)
          return
  
      # Single value.
      if isinstance(results, (int, float, np.floating)):
          return
  
      # None
      if results is None:
          raise errors.FatalTypeError(
              f"The return value of {func_name} is None. "
              "Did you forget to return the metrics? "
          )
  
      # objective left unspecified,
      # and objective value is not a single float.
      if isinstance(objective, obj_module.DefaultObjective) and not (
          isinstance(results, dict) and objective.name in results
      ):
          raise errors.FatalTypeError(
              f"Expected the return value of {func_name} to be "
              "a single float when `objective` is left unspecified. "
              f"Recevied return value: {results} of type {type(results)}."
          )
  
      # A dictionary.
      if isinstance(results, dict):
          if objective.name not in results:
              raise errors.FatalValueError(
                  f"Expected the returned dictionary from {func_name} to have "
                  f"the specified objective, {objective.name}, "
                  "as one of the keys. "
                  f"Received: {results}."
              )
          return
  
      # A History.
      if isinstance(results, keras.callbacks.History):
          return
  
      # Other unsupported types.
      raise errors.FatalTypeError(
          f"Expected the return value of {func_name} to be "
          "one of float, dict, keras.callbacks.History, "
          "or a list of one of these types. "
          f"Recevied return value: {results} of type {type(results)}."
      )
  
imports: import collections
  import statistics
  import numpy
  from keras_tuner import backend
  from keras_tuner import errors
  from keras_tuner.backend import config
  from keras_tuner.backend import keras
  from keras_tuner.engine import hyperparameters
  from keras_tuner.engine import objective
label_desc: Use image node_id 4 for calling a global function with example usage: validate_trial_results(results, objective, func_name) without return types