code: def load_logs(optimizer, logs):
      """Load previous ..."""
  
      if isinstance(logs, str):
          logs = [logs]
  
      for log in logs:
          with open(log, "r") as j:
              while True:
                  try:
                      iteration = next(j)
                  except StopIteration:
                      break
  
                  iteration = json.loads(iteration)
                  try:
                      optimizer.register(
                          params=iteration["params"],
                          target=iteration["target"],
                          constraint_value=iteration["constraint"]
                          if optimizer.is_constrained
                          else None,
                      )
                  except NotUniqueError:
                      continue
  
      return optimizer
  
imports: import warnings
  import numpy
  from scipy.stats import norm
  from scipy.optimize import minimize
  from colorama import just_fix_windows_console
  import json
label_desc: Use image node_id 2 for calling a global function with example usage: load_logs(optimizer, logs) and returns: optimizer