code: def _parse_value(
      value: str | int | float | bool | None,
      column_data_kind: ColumnDataKind,
  ) -> Any:
      """Convert a value to the correct type.
  
      Parameters
      ----------
      value : str | int | float | bool | None
          The value to convert.
  
      column_data_kind : ColumnDataKind
          The determined data kind of the column. The column data kind refers to the
          shared data type of the values in the column (e.g. int, float, str).
  
      Returns
      -------
      The converted value.
      """
      if value is None:
          return None
  
      try:
          if column_data_kind == ColumnDataKind.STRING:
              return str(value)
  
          if column_data_kind == ColumnDataKind.INTEGER:
              return int(value)
  
          if column_data_kind == ColumnDataKind.FLOAT:
              return float(value)
  
          if column_data_kind == ColumnDataKind.BOOLEAN:
              return bool(value)
  
          if column_data_kind == ColumnDataKind.DECIMAL:
              # Decimal theoretically can also be initialized via number values.
              # However, using number values here seems to cause issues with Arrow
              # serialization, once you try to render the returned dataframe.
              return Decimal(str(value))
  
          if column_data_kind == ColumnDataKind.TIMEDELTA:
              return pd.Timedelta(value)
  
          if column_data_kind in [
              ColumnDataKind.DATETIME,
              ColumnDataKind.DATE,
              ColumnDataKind.TIME,
          ]:
              datetime_value = pd.Timestamp(value)
  
              if datetime_value is pd.NaT:
                  return None
  
              if column_data_kind == ColumnDataKind.DATETIME:
                  return datetime_value
  
              if column_data_kind == ColumnDataKind.DATE:
                  return datetime_value.date()
  
              if column_data_kind == ColumnDataKind.TIME:
                  return datetime_value.time()
  
      except (ValueError, pd.errors.ParserError) as ex:
          _LOGGER.warning(
              "Failed to parse value %s as %s. Exception: %s",
              value,
              column_data_kind,
              ex,
          )
          return None
      return value
  
imports: from __future__ import annotations
  import json
  from dataclasses import dataclass
  from decimal import Decimal
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Optional, Set, Tuple, TypeVar, Union, cast, overload
  import pandas
  import pyarrow
  from typing_extensions import Literal, TypeAlias, TypedDict
  from streamlit import logger
  from streamlit import type_util
  from streamlit.deprecation_util import deprecate_func_name
  from streamlit.elements.form import current_form_id
  from streamlit.elements.lib.column_config_utils import INDEX_IDENTIFIER, ColumnConfigMapping, ColumnConfigMappingInput, ColumnDataKind, DataframeSchema, apply_data_specific_configs, determine_dataframe_schema, is_type_compatible, marshall_column_config, process_config_mapping, update_column_config
  from streamlit.elements.lib.pandas_styler_utils import marshall_styler
  from streamlit.elements.utils import check_callback_rules, check_session_state_rules
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Arrow_pb2 import Arrow
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner import get_script_run_ctx
  from streamlit.runtime.state import WidgetArgs, WidgetCallback, WidgetKwargs, register_widget
  from streamlit.runtime.state.common import compute_widget_id
  from streamlit.type_util import DataFormat, DataFrameGenericAlias, Key, is_type, to_key
  from streamlit.util import calc_md5
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_value(value, column_data_kind) and returns: value, None, str, int, float, bool, Decimal, pd, None, None, datetime_value, datetime_value, datetime_value