code: def _enforce_params_schema(
      params: Optional[Dict[str, Any]], schema: Optional[ParamSchema]
  ):
      if schema is None:
          if params in [None, {}]:
              return params
          params_info = (
              f"Ignoring provided params: {list(params.keys())}"
              if isinstance(params, dict)
              else "Ignoring invalid params (not a dictionary)."
          )
          _logger.warning(
              "`params` can only be specified at inference time if the model signature "
              f"defines a params schema. This model does not define a params schema. {params_info}",
          )
          return {}
      params = {} if params is None else params
      if not isinstance(params, dict):
          raise MlflowException.invalid_parameter_value(
              f"Parameters must be a dictionary. Got type '{type(params).__name__}'.",
          )
      if not isinstance(schema, ParamSchema):
          raise MlflowException.invalid_parameter_value(
              "Parameters schema must be an instance of ParamSchema. "
              f"Got type '{type(schema).__name__}'.",
          )
      if any(not isinstance(k, str) for k in params.keys()):
          _logger.warning(
              "Keys in parameters should be of type `str`, but received non-string keys."
              "Converting all keys to string..."
          )
          params = {str(k): v for k, v in params.items()}
  
      allowed_keys = {param.name for param in schema.params}
      ignored_keys = set(params) - allowed_keys
      if ignored_keys:
          _logger.warning(
              f"Unrecognized params {list(ignored_keys)} are ignored for inference. "
              f"Supported params are: {allowed_keys}. "
              "To enable them, please add corresponding schema in ModelSignature."
          )
  
      params = {k: params[k] for k in params if k in allowed_keys}
  
      invalid_params = set()
      for param_spec in schema.params:
          if param_spec.name in params:
              try:
                  params[
                      param_spec.name
                  ] = ParamSpec.validate_param_spec(
                      params[param_spec.name], param_spec
                  )
              except MlflowException as e:
                  invalid_params.add((param_spec.name, e.message))
          else:
              params[param_spec.name] = param_spec.default
  
      if invalid_params:
          raise MlflowException.invalid_parameter_value(
              f"Invalid parameters found: {invalid_params!r}",
          )
  
      return params
  
imports: import datetime
  import decimal
  import json
  import logging
  import os
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException
  from mlflow.models import Model
  from mlflow.store.artifact.utils.models import get_model_name_and_version
  from mlflow.types import DataType, ParamSchema, ParamSpec, Schema, TensorSpec
  from mlflow.types.schema import Array, Object, Property
  from mlflow.types.utils import TensorsNotSupportedException, _infer_param_schema, clean_tensor_type
  from mlflow.utils.annotations import experimental
  from mlflow.utils.proto_json_utils import NumpyEncoder, dataframe_from_parsed_json, parse_tf_serving_input
  from mlflow.utils.uri import get_databricks_profile_uri_from_artifact_uri
label_desc: Use image node_id 23 for calling a global function with example usage: _enforce_params_schema(params, schema) and returns: params, dict, params