code: def bartlett(*args):
      """Perform Bartlett's test for equal variances.
  
      Bartlett's test tests the null hypothesis that all input samples
      are from populations with equal variances.  For samples
      from significantly non-normal populations, Levene's test
      `levene` is more robust.
  
      Parameters
      ----------
      sample1, sample2,... : array_like
          arrays of sample data.  Only 1d arrays are accepted, they may have
          different lengths.
  
      Returns
      -------
      statistic : float
          The test statistic.
      pvalue : float
          The p-value of the test.
  
      See Also
      --------
      fligner : A non-parametric test for the equality of k variances
      levene : A robust parametric test for equality of k variances
  
      Notes
      -----
      Conover et al. (1981) examine many of the existing parametric and
      nonparametric tests by extensive simulations and they conclude that the
      tests proposed by Fligner and Killeen (1976) and Levene (1960) appear to be
      superior in terms of robustness of departures from normality and power
      ([3]_).
  
      References
      ----------
      .. [1]  https://www.itl.nist.gov/div898/handbook/eda/section3/eda357.htm
  
      .. [2]  Snedecor, George W. and Cochran, William G. (1989), Statistical
                Methods, Eighth Edition, Iowa State University Press.
  
      .. [3] Park, C. and Lindsay, B. G. (1999). Robust Scale Estimation and
             Hypothesis Testing based on Quadratic Inference Function. Technical
             Report #99-03, Center for Likelihood Studies, Pennsylvania State
             University.
  
      .. [4] Bartlett, M. S. (1937). Properties of Sufficiency and Statistical
             Tests. Proceedings of the Royal Society of London. Series A,
             Mathematical and Physical Sciences, Vol. 160, No.901, pp. 268-282.
  
      Examples
      --------
      Test whether or not the lists `a`, `b` and `c` come from populations
      with equal variances.
  
      >>> from scipy.stats import bartlett
      >>> a = [8.88, 9.12, 9.04, 8.98, 9.00, 9.08, 9.01, 8.85, 9.06, 8.99]
      >>> b = [8.88, 8.95, 9.29, 9.44, 9.15, 9.58, 8.36, 9.18, 8.67, 9.05]
      >>> c = [8.95, 9.12, 8.95, 8.85, 9.03, 8.84, 9.07, 8.98, 8.86, 8.98]
      >>> stat, p = bartlett(a, b, c)
      >>> p
      1.1254782518834628e-05
  
      The very small p-value suggests that the populations do not have equal
      variances.
  
      This is not surprising, given that the sample variance of `b` is much
      larger than that of `a` and `c`:
  
      >>> [np.var(x, ddof=1) for x in [a, b, c]]
      [0.007054444444444413, 0.13073888888888888, 0.008890000000000002]
  
      """
      # Handle empty input and input that is not 1d
      for a in args:
          if np.asanyarray(a).size == 0:
              return BartlettResult(np.nan, np.nan)
          if np.asanyarray(a).ndim > 1:
              raise ValueError("Samples must be one-dimensional.")
  
      k = len(args)
      if k < 2:
          raise ValueError(
              "Must enter at least two input sample vectors."
          )
      Ni = np.empty(k)
      ssq = np.empty(k, "d")
      for j in range(k):
          Ni[j] = len(args[j])
          ssq[j] = np.var(args[j], ddof=1)
      Ntot = np.sum(Ni, axis=0)
      spsq = np.sum((Ni - 1) * ssq, axis=0) / (1.0 * (Ntot - k))
      numer = (Ntot * 1.0 - k) * log(spsq) - np.sum(
          (Ni - 1.0) * log(ssq), axis=0
      )
      denom = 1.0 + 1.0 / (3 * (k - 1)) * (
          (np.sum(1.0 / (Ni - 1.0), axis=0)) - 1.0 / (Ntot - k)
      )
      T = numer / denom
      pval = distributions.chi2.sf(T, k - 1)  # 1 - cdf
  
      return BartlettResult(T, pval)
  
imports: from __future__ import annotations
  import math
  import warnings
  from collections import namedtuple
  import numpy
  from numpy import isscalar, r_, log, around, unique, asarray, zeros, arange, sort, amin, amax, atleast_1d, sqrt, array, compress, pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot
  from scipy import optimize
  from scipy import special
  from .None import statlib
  from .None import stats
  from .stats import find_repeats, _contains_nan, _normtest_finish
  from .contingency import chi2_contingency
  from .None import distributions
  from ._distn_infrastructure import rv_generic
  from ._hypotests import _get_wilcoxon_distr
label_desc: Use image node_id 28 for calling a global function with example usage: bartlett() and returns: BartlettResult, BartlettResult