code: def get_weighted_variance(x, sample_weight):
      """
      Calculate the variance of array x with sample_weight.
  
      Args
      ----
  
      x : (np.array)
          A list of number
  
      sample_weight (np.array or list): an array of sample weights indicating the
          weight of each observation for `effect_learner`. If None, it assumes equal weight.
  
      Returns
      -------
      The variance of x with sample weight
      """
      average = np.average(x, weights=sample_weight)
      variance = np.average((x - average) ** 2, weights=sample_weight)
      return variance
  
file_path: causalml/causalml/inference/meta/utils.py
imports: import pandas
  import numpy
  from packaging import version
  from xgboost import __version__
label_desc: Use image node_id 7 for calling a global function with example usage: get_weighted_variance(x, sample_weight) and returns: variance