code: def _expr_to_config(expr, conditions, hps):
      if expr.name == "switch":
          idx = expr.inputs()[0]
          options = expr.inputs()[1:]
          assert idx.name == "hyperopt_param"
          assert idx.arg["obj"].name in (
              "randint",  # -- in case of hp.choice
              "categorical",  # -- in case of hp.pchoice
          )
          _expr_to_config(idx, conditions, hps)
          for ii, opt in enumerate(options):
              _expr_to_config(
                  opt, conditions + (EQ(idx.arg["label"].obj, ii),), hps
              )
      elif expr.name == "hyperopt_param":
          label = expr.arg["label"].obj
          if label in hps:
              if hps[label]["node"] != expr.arg["obj"]:
                  raise DuplicateLabel(label)
              hps[label]["conditions"].add(conditions)
          else:
              hps[label] = {
                  "node": expr.arg["obj"],
                  "conditions": {conditions},
                  "label": label,
              }
      else:
          for ii in expr.inputs():
              _expr_to_config(ii, conditions, hps)
  
imports: from functools import partial, wraps
  from .base import DuplicateLabel
  from .pyll.base import Apply, Literal, MissingArgument
  from .pyll import scope
  from .pyll import as_apply
label_desc: Use image node_id 16 for calling a global function with example usage: _expr_to_config(expr, conditions, hps) without return types