code: def to_dimension(value: AnyDimension) -> Dimension:
      """
      Turn the given object into a `Dimension` object.
      """
      if value is None:
          return Dimension()
      if isinstance(value, int):
          return Dimension.exact(value)
      if isinstance(value, Dimension):
          return value
      if callable(value):
          return to_dimension(value())
  
      raise ValueError("Not an integer or Dimension object.")
  
file_path: catboost/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/dimension.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, Callable, Union
label_desc: Use image node_id 3 for calling a global function with example usage: to_dimension(value) and returns: Dimension, Dimension, value, to_dimension