code: def get_objective(trial: Trial) -> float | None:
      """Get the value for the objective, if it exists, for this trial
  
      :return: Float or None
          The value of the objective, or None if it doesn't exist
      """
      objectives = [
          result.value
          for result in trial.results
          if result.type == "objective"
      ]
      objective: float | None = None
      if not objectives:
          objective = None
      elif len(objectives) == 1:
          objective = objectives[0]
      elif len(objectives) > 1:
          raise RuntimeError(
              f"Trial {trial.id} has {len(objectives)} objectives"
          )
  
      return objective
  
imports: from __future__ import annotations
  import copy
  import logging
  from orion.algo.base.registry import Registry
  from orion.core.utils import GenericFactory
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 1 for calling a global function with example usage: get_objective(trial) and returns: objective