code: def kolmogorov_smirnov(
      dist1: Union[np.ndarray, pd.Series],
      dist2: Union[np.ndarray, pd.Series],
  ) -> float:
      """
      Perform the two-sample Kolmogorov-Smirnov test for goodness of fit.
  
      This test compares the underlying continuous distributions F(x) and G(x)
      of two independent samples.
  
      This function is based on the ks_2samp function from scipy.stats, but it only calculates
      the test statistic. This is useful for large datasets, where the p-value is not needed.
  
      Also, this function assumes the alternative hypothesis is two-sided (F(x)!= G(x)).
  
      Parameters
      ----------
      dist1, dist2 : array_like, 1-Dimensional
          Two arrays of sample observations assumed to be drawn from a continuous
          distribution, sample sizes can be different.
  
      Returns
      -------
      statistic : float
          KS statistic.
  
  
      License
      ----------
      This is a modified version of the ks_2samp function from scipy.stats. The original license is as follows:
  
      Copyright (c) 2001-2002 Enthought, Inc. 2003-2023, SciPy Developers.
      All rights reserved.
  
      Redistribution and use in source and binary forms, with or without
      modification, are permitted provided that the following conditions
      are met:
  
      1. Redistributions of source code must retain the above copyright
         notice, this list of conditions and the following disclaimer.
  
      2. Redistributions in binary form must reproduce the above
         copyright notice, this list of conditions and the following
         disclaimer in the documentation and/or other materials provided
         with the distribution.
  
      3. Neither the name of the copyright holder nor the names of its
         contributors may be used to endorse or promote products derived
         from this software without specific prior written permission.
  
      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      """
      if np.ma.is_masked(dist1):
          dist1 = dist1.compressed()
      if np.ma.is_masked(dist2):
          dist2 = dist2.compressed()
      dist1 = np.sort(dist1)
      dist2 = np.sort(dist2)
      n1 = dist1.shape[0]
      n2 = dist2.shape[0]
      if min(n1, n2) == 0:
          raise ValueError("Data must not be empty")
  
      data_all = np.concatenate([dist1, dist2])
      # using searchsorted solves equal data problem
      cdf1 = np.searchsorted(dist1, data_all, side="right") / n1
      cdf2 = np.searchsorted(dist2, data_all, side="right") / n2
      cddiffs = np.abs(cdf1 - cdf2)
      return np.max(cddiffs)
  
imports: from numbers import Number
  from typing import Dict, Optional, Tuple, Union
  import numpy
  import pandas
  from plotly.graph_objs import Figure
  from plotly.subplots import make_subplots
  from scipy.stats import chi2_contingency, wasserstein_distance
  from deepchecks.core import ConditionCategory, ConditionResult
  from deepchecks.core.errors import DeepchecksValueError, NotEnoughSamplesError
  from deepchecks.utils.dict_funcs import get_dict_entry_by_value
  from deepchecks.utils.distribution.plot import CategoriesSortingKind, drift_score_bar_traces, feature_distribution_traces
  from deepchecks.utils.distribution.preprocessing import preprocess_2_cat_cols_to_same_bins
  from deepchecks.utils.plot import DEFAULT_DATASET_NAMES
  from deepchecks.utils.strings import format_number
label_desc: Use image node_id 7 for calling a global function with example usage: kolmogorov_smirnov(dist1, dist2) and returns: np