code: def hellinger(vec1, vec2):
      """Calculate Hellinger distance between two probability distributions.
  
      Parameters
      ----------
      vec1 : {scipy.sparse, numpy.ndarray, list of (int, float)}
          Distribution vector.
      vec2 : {scipy.sparse, numpy.ndarray, list of (int, float)}
          Distribution vector.
  
      Returns
      -------
      float
          Hellinger distance between `vec1` and `vec2`.
          Value in range `[0, 1]`, where 0 is min distance (max similarity) and 1 is max distance (min similarity).
  
      """
      if scipy.sparse.issparse(vec1):
          vec1 = vec1.toarray()
      if scipy.sparse.issparse(vec2):
          vec2 = vec2.toarray()
      if isbow(vec1) and isbow(vec2):
          # if it is a BoW format, instead of converting to dense we use dictionaries to calculate appropriate distance
          vec1, vec2 = dict(vec1), dict(vec2)
          indices = set(list(vec1.keys()) + list(vec2.keys()))
          sim = np.sqrt(
              0.5
              * sum(
                  (
                      np.sqrt(vec1.get(index, 0.0))
                      - np.sqrt(vec2.get(index, 0.0))
                  )
                  ** 2
                  for index in indices
              )
          )
          return sim
      else:
          sim = np.sqrt(
              0.5 * ((np.sqrt(vec1) - np.sqrt(vec2)) ** 2).sum()
          )
          return sim
  
imports: from __future__ import with_statement
  import logging
  import math
  from gensim import utils
  import numpy
  import scipy.sparse
  from scipy.stats import entropy
  from scipy.linalg import get_blas_funcs, triu
  from scipy.linalg.lapack import get_lapack_funcs
  from scipy.special import psi
label_desc: Use image node_id 23 for calling a global function with example usage: hellinger(vec1, vec2) and returns: sim, sim