code: def _validate_constructor(
      constructor_fn: callable, constructor_name: str
  ):
      if not constructor_name.startswith(
          "load_"
      ) and not constructor_name.startswith("from_"):
          raise MlflowException(
              f"Invalid dataset constructor name: {constructor_name}."
              f" Constructor name must start with 'load_' or 'from_'.",
              INVALID_PARAMETER_VALUE,
          )
  
      signature = inspect.signature(constructor_fn)
      parameters = signature.parameters
      for expected_kwarg in ["name", "digest"]:
          if expected_kwarg not in parameters or parameters[
              expected_kwarg
          ].kind not in [
              inspect.Parameter.KEYWORD_ONLY,
              inspect.Parameter.POSITIONAL_OR_KEYWORD,
          ]:
              raise MlflowException(
                  f"Invalid dataset constructor function: {constructor_fn.__name__}. Function"
                  f" must define an optional parameter named '{expected_kwarg}'.",
                  INVALID_PARAMETER_VALUE,
              )
  
      if not issubclass(signature.return_annotation, Dataset):
          raise MlflowException(
              f"Invalid dataset constructor function: {constructor_fn.__name__}. Function must"
              f" have a return type annotation that is a subclass of"
              f" :py:class:`mlflow.data.dataset.Dataset`.",
              INVALID_PARAMETER_VALUE,
          )
  
file_path: mlflow/mlflow/data/dataset_registry.py
imports: import inspect
  import warnings
  from contextlib import suppress
  from typing import Dict, Optional
  import entrypoints
  import mlflow.data
  from mlflow.data.dataset import Dataset
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
label_desc: Use image node_id 4 for calling the DatasetRegistry obj's underlying member method code with example usage: obj._validate_constructor(constructor_fn, constructor_name) without return types