code: def prune(matrix, threshold):
      
      if isspmatrix(matrix):
          pruned = dok_matrix(matrix.shape)
          pruned[matrix >= threshold] = matrix[matrix >= threshold]
          pruned = pruned.tocsc()
      else:
          pruned = matrix.copy()
          pruned[pruned < threshold] = 0
  
      # keep max value in each column. same behaviour for dense/sparse
      num_cols = matrix.shape[1]
      row_indices = matrix.argmax(axis=0).reshape((num_cols,))
      col_indices = np.arange(num_cols)
      pruned[row_indices, col_indices] = matrix[row_indices, col_indices]
  
      return pruned
docs: Prune the matrix so that very small edges are removed.
      The maximum value in each column is never pruned.
      
      :param matrix: The matrix to be pruned
      :param threshold: The value below which edges will be removed
      :returns: The pruned matrix