code: def _covar_module_argparse_base(
      covar_module_class: Type[Kernel],
      botorch_model_class: Optional[Type[Model]] = None,
      dataset: Optional[SupervisedDataset] = None,
      covar_module_options: Optional[Dict[str, Any]] = None,
      **kwargs: Any,
  ) -> Dict[str, Any]:
      """
      Extract the covar module kwargs form the given arguments.
  
      NOTE: Since `covar_module_options` is how the user would typically pass in these
      options, it takes precedence over other arguments. E.g., if both `ard_num_dims`
      and `covar_module_options["ard_num_dims"]` are provided, this will use
      `ard_num_dims` from `covar_module_options`.
  
      Args:
          covar_module_class: Covariance module class.
          botorch_model_class: ``Model`` class to be used as the underlying
              BoTorch model.
          dataset: Dataset containing feature matrix and the response.
          covar_module_options: An optional dictionary of covariance module options.
              This may include overrides for the above options. For example, when
              covar_module_class is MaternKernel this dictionary might include
              {
                  "nu": 2.5, # the smoothness parameter
                  "ard_num_dims": 3, # the num. of lengthscales per input dimension
                  "batch_shape": torch.Size([2]), # the num. of lengthscales per batch,
                      # e.g., metric
                  "lengthscale_prior": GammaPrior(6.0, 3.0), # prior for the lengthscale
                      # parameter
              }
              See `gpytorch/kernels/matern_kernel.py` for more options.
  
      Returns:
          A dictionary with covar module kwargs.
      """
      covar_module_options = covar_module_options or {}
      return {**kwargs, **covar_module_options}
  
file_path: Ax/ax/models/torch/botorch_modular/input_constructors/covar_modules.py
imports: from __future__ import annotations
  from typing import Any, Dict, Optional, Type, Union
  import torch
  from ax.models.torch.botorch_modular.kernels import ScaleMaternKernel
  from ax.utils.common.typeutils import _argparse_type_encoder
  from botorch.models import MultiTaskGP
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.models.model import Model
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.dispatcher import Dispatcher
  from botorch.utils.types import _DefaultType, DEFAULT
  from gpytorch.kernels.kernel import Kernel
  from gpytorch.priors.torch_priors import Prior
label_desc: Use image node_id 1 for calling a global function with example usage: _covar_module_argparse_base(covar_module_class, botorch_model_class, dataset, covar_module_options) and returns: dict