code: def _weighted_variance(values, weights):
      if weights is None:
          variance = np.var(values)
      else:
          mean = _weighted_mean(values, weights)
          variance = np.sum((values - mean) ** 2 * weights) / np.sum(
              weights
          )
      assert np.isfinite(variance)
      return variance
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  from tensorflow_data_validation.utils import variance_util
label_desc: Use image node_id 2 for calling a global function with example usage: _weighted_variance(values, weights) and returns: variance