class_docstr: Class to execute target functions which are python functions. Evaluates function for given
  configuration and resource limit.
  
  The target function can either return a float (the loss), or a tuple with the first element
  being a float and the second being additional run information. In a multi-objective
  setting, the float value is replaced by a list of floats.
  
  Parameters
  ----------
  target_function : Callable
      The target function.
  scenario : Scenario
  required_arguments : list[str], defaults to []
      A list of required arguments, which are passed to the target function.
class_docstr_tok: ["Class","to","execute","target","functions","which","are","python","functions",".","Evaluates","function","for","given","configuration","and","resource","limit",".","The","target","function","can","either","return","a","float","(","the","loss",")",",","or","a","tuple","with","the","first","element","being","a","float","and","the","second","being","additional","run","information",".","In","a","multi-objective","setting",",","the","float","value","is","replaced","by","a","list","of","floats",".","Parameters","--","--","--","--","--","target_function",":","Callable","The","target","function",".","scenario",":","Scenario","required_arguments",":","list","[","str","]",",","defaults","to","[","]","A","list","of","required","arguments",",","which","are","passed","to","the","target","function","."]
code: def __init__(
      self,
      scenario: Scenario,
      target_function: Callable,
      required_arguments: list[str] = [],
  ):
      super().__init__(
          scenario=scenario, required_arguments=required_arguments
      )
      self._target_function = target_function
  
      # Check if target function is callable
      if not callable(self._target_function):
          raise TypeError(
              "Argument `target_function` must be a callable but is type"
              f"`{type(self._target_function)}`."
          )
  
      # Signatures here
      signature = inspect.signature(self._target_function).parameters
      for argument in required_arguments:
          if argument not in signature.keys():
              raise RuntimeError(
                  f"Target function needs to have the arguments {required_arguments} "
                  f"but could not find {argument}."
              )
  
      # Now we check for additional arguments which are not used by SMAC
      # However, we only want to warn the user and not
      for key in list(signature.keys())[1:]:
          if key not in required_arguments:
              logger.warning(
                  f"The argument {key} is not set by SMAC: Consider removing it from the target function."
              )
  
      # Pynisher limitations
      if (memory := self._scenario.trial_memory_limit) is not None:
          unit = None
          if isinstance(memory, (tuple, list)):
              memory, unit = memory
          memory = int(math.ceil(memory))
          if unit is not None:
              memory = (memory, unit)
  
      if (time := self._scenario.trial_walltime_limit) is not None:
          time = int(math.ceil(time))
  
      self._memory_limit = memory
      self._algorithm_walltime_limit = time
  
imports: from __future__ import annotations
  from typing import Any, Callable
  import copy
  import inspect
  import math
  import time
  import traceback
  from functools import partial
  import numpy
  from ConfigSpace import Configuration
  from pynisher import MemoryLimitException, WallTimeoutException, limit
  from smac.runner.abstract_runner import StatusType
  from smac.runner.abstract_serial_runner import AbstractSerialRunner
  from smac.scenario import Scenario
  from smac.utils.logging import get_logger
label_desc: Use image node_id 1 to create a new TargetFunctionRunner object from inherited base classes: AbstractSerialRunner with example: obj = TargetFunctionRunner(scenario, target_function, required_arguments)