code: def build_scheduler(optimizer, config):
      scheduler_config = config.get("scheduler", {})
  
      if "type" not in scheduler_config:
          warnings.warn(
              "No type for scheduler specified even though lr_scheduler is True, "
              "setting default to 'Pythia'"
          )
      scheduler_type = scheduler_config.get("type", "pythia")
  
      if "params" not in scheduler_config:
          warnings.warn(
              "scheduler attributes has no params defined, defaulting to {}."
          )
      params = scheduler_config.get("params", {})
      scheduler_class = registry.get_scheduler_class(scheduler_type)
      scheduler = scheduler_class(optimizer, **params)
  
      return scheduler
  
imports: import logging
  import os
  import warnings
  from enum import Enum
  from typing import Any, Dict, List, Optional, Tuple, Union
  import mmf
  import pytorch_lightning
  import torch
  from mmf.common.meter import Meter
  from mmf.common.registry import registry
  from mmf.datasets.iteration_strategies import ConstantIterationStrategy, IterationStrategy, SizeProportionalIterationStrategy
  from mmf.datasets.processors.processors import Processor
  from mmf.utils.configuration import Configuration, get_global_config
  from mmf.utils.distributed import is_dist_initialized, is_main, is_xla, synchronize
  from mmf.utils.general import get_optimizer_parameters
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
label_desc: Use image node_id 14 for calling a global function with example usage: build_scheduler(optimizer, config) and returns: scheduler