code: def _build_value(type_: Type, data: Any, config: Config) -> Any:
      if is_init_var(type_):
          type_ = extract_init_var(type_)
      if is_union(type_):
          return _build_value_for_union(
              union=type_, data=data, config=config
          )
      elif is_generic_collection(type_) and is_instance(
          data, extract_origin_collection(type_)
      ):
          return _build_value_for_collection(
              collection=type_, data=data, config=config
          )
      elif is_dataclass(type_) and is_instance(data, Data):
          return from_dict(data_class=type_, data=data, config=config)
      return data
  
file_path: ray/python/ray/_private/thirdparty/dacite/core.py
imports: import copy
  from dataclasses import is_dataclass
  from itertools import zip_longest
  from typing import TypeVar, Type, Optional, get_type_hints, Mapping, Any
  from .config import Config
  from .data import Data
  from .dataclasses import get_default_value_for_field, create_instance, DefaultValueNotFoundError, get_fields
  from .exceptions import ForwardReferenceError, WrongTypeError, DaciteError, UnionMatchError, MissingValueError, DaciteFieldError, UnexpectedDataError, StrictUnionMatchError
  from .types import is_instance, is_generic_collection, is_union, extract_generic, is_optional, transform_value, extract_origin_collection, is_init_var, extract_init_var
label_desc: Use image node_id 2 for calling a global function with example usage: _build_value(type_, data, config) and returns: data, _build_value_for_union, _build_value_for_collection, from_dict