code: def covariate_shift_detection(
      train_data: pd.DataFrame,
      test_data: pd.DataFrame,
      label: str,
      sample: Union[None, int, float] = DEFAULT_SAMPLE_SIZE,
      path: Optional[str] = None,
      state: Union[None, dict, AnalysisState] = None,
      return_state: bool = False,
      verbosity: int = 0,
      fig_args: Optional[Dict[str, Any]] = None,
      chart_args: Optional[Dict[str, Any]] = None,
      **fit_args,
  ):
      """
      Shortcut for covariate shift detection analysis.
  
      Detects a change in covariate (X) distribution between training and test, which we call XShift.  It can tell you
      if your training set is not representative of your test set distribution.  This is done with a Classifier 2
      Sample Test.
  
      Supported `fig_args`/`chart_args` keys:
          - `chart.<variable_name>.<property>` - properties for charts rendered during the analysis
  
      Parameters
      ----------
      train_data: Optional[DataFrame]
          training dataset
      test_data: Optional[DataFrame]
          test dataset
      label: : Optional[str]
          target variable
      state: Union[None, dict, AnalysisState], default = None
          pass prior state if necessary; the object will be updated during `anlz_facets` `fit` call.
      sample: Union[None, int, float], default = 10000
          sample size; if `int`, then row number is used;
          `float` must be between 0.0 and 1.0 and represents fraction of dataset to sample;
          `None` means no sampling
          See also :func:`autogluon.eda.analysis.dataset.Sampler`
      path: Optional[str], default = None,
          path for models saving
      return_state: bool, default = False
          return state if `True`
      verbosity: int, default = 0
          Verbosity levels range from 0 to 4 and control how much information is printed.
          Higher levels correspond to more detailed print statements (you can set verbosity = 0 to suppress warnings).
          If using logging, you can alternatively control amount of information printed via `logger.setLevel(L)`,
          where `L` ranges from 0 to 50 (Note: higher values of `L` correspond to fewer print statements, opposite of verbosity levels).
      fit_args
          kwargs to pass into `TabularPredictor` fit
      fig_args: Optional[Dict[str, Any]], default = None,
          figures args for visualizations; key == component; value = dict of kwargs for component figure. The args are supporting nested
          dot syntax: 'a.b.c'. Charts args are following the convention of `<variable_name>.<param>`
          (i.e. `chart.PassengerId.figsize` will result in setting `figsize` on `PassengerId` figure.
      chart_args: Optional[Dict[str, Any]], default = None,
          figures args for visualizations; key == component; value = dict of kwargs for component chart. The args are supporting nested
          dot syntax: 'a.b.c'. Charts args are following the convention of `<variable_name>.<param>`
          (i.e. `chart.PassengerId.fill` will result in setting `fill` on `PassengerId` chart.
  
      Returns
      -------
          state after `fit` call if `return_state` is `True`; `None` otherwise
  
      Examples
      --------
      >>> import autogluon.eda.auto as auto
      >>>
      >>> # use default settings
      >>> auto.covariate_shift_detection(train_data=..., test_data=..., label=...)
      >>>
      >>> # customize classifier and verbosity level
      >>> auto.covariate_shift_detection(train_data=..., test_data=..., label=..., verbosity=2, hyperparameters = {'GBM': {}})
  
      See Also
      --------
      :py:class:`~autogluon.eda.analysis.shift.XShiftDetector`
      :py:class:`~autogluon.eda.visualization.shift.XShiftSummary`
  
      """
      fit_args = get_default_estimator_if_not_specified(fit_args)
      fig_args = expand_nested_args_into_nested_maps(
          get_empty_dict_if_none(fig_args)
      )
      chart_args = expand_nested_args_into_nested_maps(
          get_empty_dict_if_none(chart_args)
      )
  
      state = analyze(
          train_data=train_data,
          test_data=test_data,
          label=label,
          sample=sample,
          state=state,
          return_state=True,
          anlz_facets=[
              RawTypesAnalysis(),
              VariableTypeAnalysis(),
              XShiftDetector(
                  classifier_kwargs=dict(
                      path=path, verbosity=verbosity
                  ),
                  classifier_fit_kwargs=fit_args,
              ),
          ],
          viz_facets=[XShiftSummary()],
      )
  
      # Plot distribution differences between datasets
      # TODO: move `vars_to_plot` calculation to analysis
      # type: ignore # state is always present
      xshift: AnalysisState = state.xshift_results  # type: ignore[union-attr]  # state is not none
      if xshift.detection_status:
          vars_to_plot = xshift.shift_features[
              : XShiftSummary.MAX_FEATURES_TO_DISPLAY
          ]
          if len(vars_to_plot) > 0:
              _train_data = train_data[vars_to_plot].copy()
              _train_data["__dataset__"] = "train_data"
              _test_data = test_data[vars_to_plot].copy()
              _test_data["__dataset__"] = "test_data"
              df_all = pd.concat(
                  [_train_data, _test_data], ignore_index=True
              )
  
              for var in vars_to_plot:
                  if state.variable_type.train_data[var] != "category":  # type: ignore
                      pvalue = xshift.feature_importance.loc[var][
                          "p_value"
                      ]
                      analyze(
                          viz_facets=[
                              MarkdownSectionComponent(
                                  f"**`{var}` values distribution between datasets; p-value: `{pvalue:.4f}`**"
                              )
                          ]
                      )
  
                      analyze_interaction(
                          train_data=df_all,
                          state=state,
                          x=var,
                          hue="__dataset__",
                          fig_args=fig_args.get("chart", {}).get(
                              var, {}
                          ),
                          chart_args=chart_args.get("chart", {}).get(
                              var, {}
                          ),
                      )
  
      return state if return_state else None
  
imports: import logging
  from typing import Any, Dict, List, Optional, Tuple, Union
  import pandas
  from autogluon.common.utils.log_utils import verbosity2loglevel
  from autogluon.features import CategoryFeatureGenerator
  from autogluon.tabular import TabularPredictor
  from ..None import AnalysisState
  from ..analysis import AnomalyDetectorAnalysis, ApplyFeatureGenerator, AutoGluonModelEvaluator, AutoGluonModelQuickFit, Correlation, DistributionFit, FeatureInteraction, MissingValuesAnalysis, ProblemTypeControl, ShapAnalysis, TrainValidationSplit, XShiftDetector
  from ..analysis.base import AbstractAnalysis, BaseAnalysis, SaveArgsToState
  from ..analysis.dataset import DatasetSummary, LabelInsightsAnalysis, RawTypesAnalysis, Sampler, SpecialTypesAnalysis, VariableTypeAnalysis
  from ..analysis.interaction import FeatureDistanceAnalysis
  from ..state import is_key_present_in_state
  from ..utils.common import expand_nested_args_into_nested_maps, get_empty_dict_if_none
  from ..utils.defaults import QuickFitDefaults
  from ..visualization import AnomalyScoresVisualization, ConfusionMatrix, CorrelationVisualization, DatasetStatistics, DatasetTypeMismatch, ExplainForcePlot, ExplainWaterfallPlot, FeatureImportance, FeatureInteractionVisualization, LabelInsightsVisualization, MarkdownSectionComponent, MissingValues, ModelLeaderboard, PropertyRendererComponent, RegressionEvaluation, XShiftSummary
  from ..visualization.base import AbstractVisualization
  from ..visualization.interaction import FeatureDistanceAnalysisVisualization, PDPInteractions
  from ..visualization.layouts import SimpleVerticalLinearLayout
label_desc: Use image node_id 6 for calling a global function with example usage: covariate_shift_detection(train_data, test_data, label, sample, path, state, return_state, verbosity, fig_args, chart_args) and returns: unknown