code: def setup_trial_limits(time_limit, num_trials, hyperparameters):
      """Adjust default time limits / num_trials"""
      if num_trials is None:
          if time_limit is None:
              time_limit = 10 * 60  # run for 10min by default
          time_limit /= float(
              len(hyperparameters)
          )  # each model type gets half the available time
          num_trials = 1000  # run up to 1000 trials (or as you can within the given time_limit)
      elif time_limit is None:
          time_limit = int(
              1e6
          )  # user only specified num_trials, so run all of them regardless of time_limit
      else:
          time_limit /= float(
              len(hyperparameters)
          )  # each model type gets half the available time
  
      if (
          time_limit <= 10
      ):  # threshold = 10sec, ie. too little time to run >1 trial.
          num_trials = 1
      time_limit *= (
          0.9  # reduce slightly to account for extra time overhead
      )
      return time_limit, num_trials
  
imports: import logging
  import math
  import pickle
  import random
  import sys
  import time
  from typing import Callable, List, Tuple, Union
  import numpy
  import pandas
  import scipy.stats
  from numpy.typing import ArrayLike
  from pandas import DataFrame, Series
  from sklearn.model_selection import LeaveOneGroupOut, RepeatedKFold, RepeatedStratifiedKFold, train_test_split
  from autogluon.common.utils.resource_utils import ResourceManager
  from ..constants import BINARY, LARGE_DATA_THRESHOLD, MULTICLASS, MULTICLASS_UPPER_LIMIT, QUANTILE, REGRESS_THRESHOLD_LARGE_DATA, REGRESS_THRESHOLD_SMALL_DATA, REGRESSION, SOFTCLASS
  from ..metrics import Scorer, accuracy, pinball_loss, root_mean_squared_error
  from .miscs import warning_filter
label_desc: Use image node_id 2 for calling a global function with example usage: setup_trial_limits(time_limit, num_trials, hyperparameters) and returns: time_limit,  num_trials