code: def SchedulerDataclassField(
      default={"type": "fifo"},
      description="Hyperopt scheduler settings.",
  ):
      """Custom dataclass field that when used inside of a dataclass will allow any scheduler in
      `ludwig.schema.hyperopt.scheduler.scheduler_registry`. Sets default scheduler to 'fifo'.
  
      :param default: Dict specifying a scheduler with a `type` field and its associated parameters. Will attempt to use
             `type` to load scheduler from registry with given params. (default: {"type": "fifo"}).
      :return: Initialized dataclass field that converts untyped dicts with params to scheduler dataclass instances.
      """
  
      class SchedulerMarshmallowField(fields.Field):
          """Custom marshmallow field that deserializes a dict to a valid scheduler from
          `ludwig.schema.hyperopt.scheduler_registry` and creates a corresponding `oneOf` JSON schema for external
          usage."""
  
          def _deserialize(self, value, attr, data, **kwargs):
              if value is None:
                  return None
              if isinstance(value, dict):
                  if (
                      "type" in value
                      and value["type"]
                      in hyperopt_utils.scheduler_config_registry
                  ):
                      scheduler_config_cls = (
                          hyperopt_utils.scheduler_config_registry[
                              value["type"].lower()
                          ]
                      )
                      try:
                          return scheduler_config_cls.Schema().load(
                              value
                          )
                      except (TypeError, ValidationError) as e:
                          raise ValidationError(
                              f"Invalid params for scheduler: {value}, see `{opt}` definition. Error: {e}"
                          )
                  raise ValidationError(
                      f"Invalid params for scheduler: {value}, expect dict with at least a valid `type` attribute."
                  )
              raise ValidationError("Field should be None or dict")
  
          def _jsonschema_type_mapping(self):
              # Note that this uses the same conditional pattern as combiners:
              return {
                  "type": "object",
                  "properties": {
                      "type": {
                          "type": "string",
                          "enum": list(
                              hyperopt_utils.scheduler_config_registry.keys()
                          ),
                          "default": default["type"],
                          "description": "The type of scheduler to use during hyperopt",
                      },
                  },
                  "title": "scheduler_options",
                  "allOf": get_scheduler_conds(),
                  "required": ["type"],
                  "description": description,
              }
  
      if (
          not isinstance(default, dict)
          or "type" not in default
          or default["type"]
          not in hyperopt_utils.scheduler_config_registry
      ):
          raise ValidationError(f"Invalid default: `{default}`")
      try:
          opt = hyperopt_utils.scheduler_config_registry[
              default["type"].lower()
          ]
          load_default = lambda: opt.Schema().load(default)
          dump_default = opt.Schema().dump(default)
  
          return field(
              metadata={
                  "marshmallow_field": SchedulerMarshmallowField(
                      allow_none=False,
                      dump_default=dump_default,
                      load_default=load_default,
                      metadata={"description": description},
                  )
              },
              default_factory=load_default,
          )
      except Exception as e:
          raise ValidationError(
              f"Unsupported scheduler type: {default['type']}. See scheduler_config_registry. Details: {e}"
          )
  
imports: from abc import ABC
  from dataclasses import field
  from importlib import import_module
  from typing import Callable, Dict, Optional, Tuple, Union
  from marshmallow import fields, ValidationError
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.schema import utils
  from ludwig.schema.hyperopt import utils
  from ludwig.schema.utils import ludwig_dataclass
label_desc: Use image node_id 5 for calling a global function with example usage: SchedulerDataclassField(default, description) and returns: field, dict, None, scheduler_config_cls