code: def _validate_metric(key, value, timestamp, step):
      """
      Check that a metric with the specified key, value, timestamp, and step is valid and raise an
      exception if it isn't.
      """
      _validate_metric_name(key)
      # value must be a Number
      # since bool is an instance of Number check for bool additionally
      if not _is_numeric(value):
          raise MlflowException(
              f"Got invalid value {value} for metric '{key}' (timestamp={timestamp}). "
              "Please specify value as a valid double (64-bit floating point)",
              INVALID_PARAMETER_VALUE,
          )
  
      if not isinstance(timestamp, numbers.Number) or timestamp < 0:
          raise MlflowException(
              f"Got invalid timestamp {timestamp} for metric '{key}' (value={value}). "
              "Timestamp must be a nonnegative long (64-bit integer) ",
              INVALID_PARAMETER_VALUE,
          )
  
      if not isinstance(step, numbers.Number):
          raise MlflowException(
              f"Got invalid step {step} for metric '{key}' (value={value}). "
              "Step must be a valid long (64-bit integer).",
              INVALID_PARAMETER_VALUE,
          )
  
imports: import numbers
  import posixpath
  import re
  from typing import List
  from mlflow.entities import Dataset, DatasetInput, InputTag
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
  from mlflow.store.db.db_types import DATABASE_ENGINES
  from mlflow.utils.string_utils import is_string_type
label_desc: Use image node_id 5 for calling a global function with example usage: _validate_metric(key, value, timestamp, step) without return types