code: def _value_from_json(cls, value):
      cls_type = _get_class_type(cls)
      if value is None:
          return value
      # Unions must be first because Union explicitly doesn't
      # support __subclasscheck__.
      # optional with more than 2 classes is treated as Union
      elif _is_optional(cls) and len(cls.__args__) == 2:
          sub_cls = (
              cls.__args__[0]
              if type(None) != cls.__args__[0]
              else cls.__args__[1]
          )
          return _value_from_json(sub_cls, value)
      # nested config
      elif hasattr(cls, "_fields"):
          return config_from_json(cls, value)
      elif cls_type == Any:
          return _any_from_json(value)
      elif cls_type == Union:
          return _union_from_json(cls.__args__, value)
      elif issubclass(cls_type, Enum):
          return _enum_from_json(cls, value)
      elif issubclass(cls_type, List):
          sub_cls = cls.__args__[0]
          return [_value_from_json(sub_cls, v) for v in value]
      elif issubclass(cls_type, Tuple):
          return tuple(
              _value_from_json(c, v)
              for c, v in zip(_extend_tuple_type(cls, value), value)
          )
      elif issubclass(cls_type, Dict):
          sub_cls = cls.__args__[1]
          return {
              key: _value_from_json(sub_cls, v)
              for key, v in value.items()
          }
      # built in types
      return cls(value)
  
imports: from enum import Enum
  from typing import Any, Dict, List, Tuple, Type, Union
  from pytext.common.utils import eprint
  from .component import Registry
  from .config_adapter import upgrade_to_latest
  from .pytext_config import PyTextConfig
label_desc: Use image node_id 8 for calling a global function with example usage: _value_from_json(cls, value) and returns: cls, value, _value_from_json, config_from_json, _any_from_json, _union_from_json, _enum_from_json, unknown, tuple, unknown