code: def ensure_sparse_format(array, dtype=np.float64):
      if sp.issparse(array):
          if array.dtype != dtype:
              array = array.astype(dtype)
      else:
          array = sp.csr_matrix(array, dtype=dtype)
      return array
  
imports: import collections
  import itertools
  import numpy
  import scipy.sparse
  from scipy.stats import norm
  from sklearn.decomposition import TruncatedSVD
  from sklearn.preprocessing import normalize
  from sklearn.base import TransformerMixin, BaseEstimator
  from gensim.models.keyedvectors import BaseKeyedVectors
label_desc: Use image node_id 1 for calling a global function with example usage: ensure_sparse_format(array, dtype) and returns: array