code: def infer_unit_time(data, min_unit=3):
      duration_col = (
          "duration_mean" if "duration_mean" in data else "duration"
      )
      durations = data[duration_col].tolist()
  
      if durations[0] > durations[-1]:
          unit_time = durations[0] / len(durations)
      else:
          unit_time = durations[-1] / len(durations)
  
      if unit_time >= 60 * 60 * 24 * min_unit:
          duration = data[duration_col] / (60 * 60 * 24)
          time_unit = "day(s)"
      elif unit_time >= 60 * 60 * min_unit:
          duration = data[duration_col] / (60 * 60)
          time_unit = "hour(s)"
      elif unit_time >= 60 * min_unit:
          duration = data[duration_col] / 60
          time_unit = "minute(s)"
      else:
          duration = data[duration_col]
          time_unit = "second(s)"
      return duration, time_unit
  
imports: import functools
  from collections.abc import Iterable
  import numpy
  import pandas
  import plotly.express
  import plotly.graph_objects
  from plotly.subplots import make_subplots
  import orion.analysis
  import orion.analysis.base
  from orion.algo.space import Categorical, Fidelity
  from orion.core.worker.transformer import build_required_space
label_desc: Use image node_id 9 for calling a global function with example usage: infer_unit_time(data, min_unit) and returns: duration,  time_unit