code: def manual_unitvec(vec):
      # manual unit vector calculation for UnitvecTestCase
      vec = vec.astype(float)
      if sparse.issparse(vec):
          vec_sum_of_squares = vec.multiply(vec)
          unit = 1.0 / np.sqrt(vec_sum_of_squares.sum())
          return vec.multiply(unit)
      elif not sparse.issparse(vec):
          sum_vec_squared = np.sum(vec**2)
          vec /= np.sqrt(sum_vec_squared)
          return vec
  
imports: import logging
  import unittest
  import numpy
  from numpy.testing import assert_array_equal
  from scipy import sparse
  from scipy.sparse import csc_matrix
  from scipy.special import psi
  import gensim.matutils
label_desc: Use image node_id 4 for calling a global function with example usage: manual_unitvec(vec) and returns: vec, vec