code: def __to_yaml_truncated(value, limit: int) -> Tuple[any, int]:
      if isinstance(value, str):
          return Value.__to_yaml_truncated_str(value, limit)
      elif Value.is_primitive(value):
          return value, 1
      elif isinstance(value, list):
          return Value.__to_yaml_truncated_list(value, limit)
      elif isinstance(value, dict):
          res = {}
          total_size = 0
          for k, v in value.items():
              r, size = Value.__to_yaml_truncated(v, limit - total_size)
              res[k] = r
              if limit - total_size < size:
                  res[TRUNCATED_TOKEN] = TRUNCATED_TOKEN
                  return res, limit
              total_size += size
          return res, total_size
      elif isinstance(value, tuple):
          return tuple(Value.__to_yaml_truncated_list(value, limit))
      else:
          return Value.__to_yaml_truncated_str(
              Value.to_str(value), limit
          )
  
file_path: labml/client/labml/internal/configs/utils.py
imports: import warnings
  from typing import Tuple, Union, List, TYPE_CHECKING
label_desc: Use image node_id 4 for calling the Value obj's underlying member method code with example usage: obj.__to_yaml_truncated(value, limit) and returns: Value, value,  int, Value, res,  total_size, tuple, Value, res,  limit