code: def calculate_num_initialization_trials(
      num_tunable_parameters: int,
      num_trials: Optional[int],
      use_batch_trials: bool,
  ) -> int:
      """
      Applies rules from high to low priority
       - 1 for batch trials.
       - At least 5
       - At most 1/5th of num_trials.
       - Twice the number of tunable parameters
      """
      if use_batch_trials:  # Batched trials.
          return 1
  
      ret = 2 * num_tunable_parameters
      if num_trials is not None:
          ret = min(ret, not_none(num_trials) // 5)
      return max(ret, 5)
  
imports: import logging
  import warnings
  from math import ceil
  from typing import Any, cast, Dict, Optional, Type, Union
  import torch
  from ax.core.experiment import Experiment
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.parameter import ChoiceParameter, ParameterType, RangeParameter
  from ax.core.search_space import SearchSpace
  from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy
  from ax.modelbridge.registry import MODEL_KEY_TO_MODEL_SETUP, ModelRegistryBase, Models
  from ax.modelbridge.transforms.base import Transform
  from ax.modelbridge.transforms.winsorize import Winsorize
  from ax.models.torch.botorch_modular.model import BoTorchModel
  from ax.models.types import TConfig
  from ax.models.winsorization_config import WinsorizationConfig
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 4 for calling a global function with example usage: calculate_num_initialization_trials(num_tunable_parameters, num_trials, use_batch_trials) and returns: max, int