code: def _parse_value(value: Value) -> str:
      if value is None:
          return "—"
      if (
          isinstance(value, int)
          or isinstance(value, float)
          or isinstance(value, str)
      ):
          return str(value)
      elif hasattr(value, "item"):
          # Add support for numpy values (e.g. int16, float64, etc.)
          try:
              # Item could also be just a variable, so we use try, except
              if isinstance(value.item(), float) or isinstance(
                  value.item(), int
              ):
                  return str(value.item())
          except Exception:
              # If the numpy item is not a valid value, the TypeError below will be raised.
              pass
  
      raise TypeError(
          f"'{str(value)}' is of type {str(type(value))}, which is not an accepted type."
          " value only accepts: int, float, str, or None."
          " Please convert the value to an accepted type."
      )
  
file_path: streamlit/lib/streamlit/elements/metric.py
imports: from dataclasses import dataclass
  from textwrap import dedent
  from typing import TYPE_CHECKING, Optional, Union, cast
  from typing_extensions import Literal, TypeAlias
  from streamlit.elements.utils import get_label_visibility_proto_value
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Metric_pb2 import Metric
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.string_util import clean_text
  from streamlit.type_util import LabelVisibility, maybe_raise_label_warnings
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_value(value) and returns: str, str, str