code: def build_opt_kwargs(args):
      kwargs = {}
      optional_arg_names = [
          "time_limit_per_job",
          "optimization_time_limit",
          "compute_time_limit",
          "pool_period_min",
          "total_max_jobs",
          "min_iteration_per_job",
          "max_iteration_per_job",
          "max_number_of_concurrent_tasks",
      ]
      for arg_name in optional_arg_names:
          arg_val = getattr(args, arg_name)
          if arg_val is not None:
              kwargs[arg_name] = arg_val
      return kwargs
  
file_path: clearml/clearml/cli/hpo/__main__.py
imports: import json
  import sys
  from argparse import ArgumentParser, RawTextHelpFormatter
  import clearml.backend_api.session
  from clearml import Task
  from clearml.automation import DiscreteParameterRange, UniformIntegerParameterRange, UniformParameterRange, LogUniformParameterRange, HyperParameterOptimizer, RandomSearch, GridSearch
  from clearml.backend_interface.task.populate import CreateAndPopulate
  from clearml.version import __version__
label_desc: Use image node_id 4 for calling a global function with example usage: build_opt_kwargs(args) and returns: kwargs