code: def variance(space, points, base_point, weights=None):
      """Variance of (weighted) points wrt a base point.
  
      Parameters
      ----------
      space : Manifold
          Equipped manifold.
      points : array-like, shape=[n_samples, dim]
          Points.
      weights : array-like, shape=[n_samples,]
          Weights associated to the points.
          Optional, default: None.
  
      Returns
      -------
      var : float
         Weighted variance of the points.
      """
      if weights is None:
          n_points = gs.shape(points)[0]
          weights = gs.ones((n_points,))
  
      sum_weights = gs.sum(weights)
      sq_dists = space.metric.squared_dist(base_point, points)
      var = weights * sq_dists
  
      var = gs.sum(var)
      var /= sum_weights
  
      return var
  
imports: import abc
  import logging
  import math
  from sklearn.base import BaseEstimator
  import geomstats.backend
  import geomstats.errors
  from geomstats.geometry.discrete_curves import ElasticTranslationMetric, SRVTranslationMetric
  from geomstats.geometry.euclidean import EuclideanMetric
  from geomstats.geometry.hypersphere import HypersphereMetric
  from geomstats.geometry.matrices import MatricesMetric
  from geomstats.geometry.minkowski import MinkowskiMetric
label_desc: Use image node_id 7 for calling a global function with example usage: variance(space, points, base_point, weights) and returns: var