code: def normalize_sparse(M, norm="frag", order=1, iterations=3):
      
  
      try:
          from scipy.sparse import csr_matrix
      except ImportError as e:
          print(str(e))
          print("I am peforming dense normalization by default.")
          return normalize_dense(M.todense())
      r = csr_matrix(M)
      if norm == "SCN":
          for _ in range(1, iterations):
              row_sums = np.array(r.sum(axis=1)).flatten()
              col_sums = np.array(r.sum(axis=0)).flatten()
              row_indices, col_indices = r.nonzero()
              r.data /= row_sums[row_indices] * col_sums[col_indices]
  
      elif norm == "global":
          try:
              from scipy.sparse import linalg
              r = linalg.norm(M, ord=order)
          except (ImportError, AttributeError) as e:
              print(str(e))
              print("I can't import linalg tools for sparse matrices.")
              print("Please upgrade your scipy version to 0.16.0.")
  
      elif callable(norm):
          r = norm(M)
  
      else:
          print("Unknown norm. Returning input as fallback")
  
      return r
docs: Applies a normalization type to a sparse matrix.