code: def selection_config_from_dict(
      cfg: Dict[str, Any]
  ) -> SelectionConfigV3:
      """Recursively converts selection config from dict to a SelectionConfigV3 instance."""
      strategies = []
      for entry in cfg.get("strategies", []):
          new_entry = copy.deepcopy(entry)
          new_entry["input"] = SelectionConfigV3EntryInput(
              **entry["input"]
          )
          new_entry["strategy"] = SelectionConfigV3EntryStrategy(
              **entry["strategy"]
          )
          strategies.append(SelectionConfigV3Entry(**new_entry))
      new_cfg = copy.deepcopy(cfg)
      new_cfg["strategies"] = strategies
      return SelectionConfigV3(**new_cfg)
  
imports: import copy
  import dataclasses
  import difflib
  import json
  import time
  from functools import partial
  from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar, Union
  from lightly.api import utils
  from lightly.openapi_generated.swagger_client.api_client import ApiClient
  from lightly.openapi_generated.swagger_client.models import CreateDockerWorkerRegistryEntryRequest, DockerRunData, DockerRunScheduledCreateRequest, DockerRunScheduledData, DockerRunScheduledPriority, DockerRunScheduledState, DockerRunState, DockerWorkerConfigV3, DockerWorkerConfigV3CreateRequest, DockerWorkerConfigV3Docker, DockerWorkerConfigV3Lightly, DockerWorkerRegistryEntryData, DockerWorkerType, SelectionConfigV3, SelectionConfigV3Entry, SelectionConfigV3EntryInput, SelectionConfigV3EntryStrategy, TagData
  from lightly.openapi_generated.swagger_client.rest import ApiException
label_desc: Use image node_id 1 for calling a global function with example usage: selection_config_from_dict(cfg) and returns: SelectionConfigV3