code: def minimize(
      model,
      data,
      algo,
      max_evals,
      trials,
      functions=None,
      rseed=1337,
      notebook_name=None,
      verbose=True,
      eval_space=False,
      return_space=False,
      keep_temp=False,
      data_args=None,
  ):
      """
      Minimize a keras model for given data and implicit hyperparameters.
  
      Parameters
      ----------
      model: A function defining a keras model with hyperas templates, which returns a
          valid hyperopt results dictionary, e.g.
          return {'loss': -acc, 'status': STATUS_OK}
      data: A parameter-less function that defines and return all data needed in the above
          model definition.
      algo: A hyperopt algorithm, like tpe.suggest or rand.suggest
      max_evals: Maximum number of optimization runs
      trials: A hyperopt trials object, used to store intermediate results for all
          optimization runs
      rseed: Integer random seed for experiments
      notebook_name: If running from an ipython notebook, provide filename (not path)
      verbose: Print verbose output
      eval_space: Evaluate the best run in the search space such that 'choice's contain actually meaningful values instead of mere indices
      return_space: Return the hyperopt search space object (e.g. for further processing) as last return value
      keep_temp: Keep temp_model.py file on the filesystem
      data_args: Arguments to be passed to data function
  
      Returns
      -------
      If `return_space` is False: A pair consisting of the results dictionary of the best run and the corresponding
      keras model.
      If `return_space` is True: The pair of best result and corresponding keras model, and the hyperopt search space
      """
      best_run, space = base_minimizer(
          model=model,
          data=data,
          functions=functions,
          algo=algo,
          max_evals=max_evals,
          trials=trials,
          rseed=rseed,
          full_model_string=None,
          notebook_name=notebook_name,
          verbose=verbose,
          keep_temp=keep_temp,
          data_args=data_args,
      )
  
      best_model = None
      for trial in trials:
          vals = trial.get("misc").get("vals")
          # unpack the values from lists without overwriting the mutable dict within 'trial'
          unpacked_vals = unpack_hyperopt_vals(vals)
          # identify the best_run (comes with unpacked values from the hyperopt function `base.Trials.argmin`)
          if (
              unpacked_vals == best_run
              and "model" in trial.get("result").keys()
          ):
              best_model = trial.get("result").get("model")
  
      if eval_space is True:
          # evaluate the search space
          best_run = eval_hyperopt_space(space, best_run)
  
      if return_space is True:
          # return the space as well
          return best_run, best_model, space
      else:
          # the default case for backwards compatibility with expanded return arguments
          return best_run, best_model
  
imports: import inspect
  import os
  import re
  import sys
  import nbformat
  import numpy
  from hyperopt import fmin
  from nbconvert import PythonExporter
  from .ensemble import VotingModel
  from .utils import remove_imports, remove_all_comments, extract_imports, temp_string, write_temp_files, determine_indent, with_line_numbers, unpack_hyperopt_vals, eval_hyperopt_space, find_signature_end
label_desc: Use image node_id 1 for calling a global function with example usage: minimize(model, data, algo, max_evals, trials, functions, rseed, notebook_name, verbose, eval_space, return_space, keep_temp, data_args) and returns: best_run,  best_model,  space, best_run,  best_model