ity=0.1, masking_function=default_masking_function):
    &#34;&#34;&#34;Prunes a ndarray to a desired target sparsity.

    Args:
      ndarray: target numpy array
      p_sparsity (float, optional): desired layer sparsity
      masking_function: neuron masking function
    Returns:
      ndarray: pruned ndarray
    &#34;&#34;&#34;
    shape = ndarray.shape

    # deep copy layer
    layer = np.array(ndarray)

    neuron_weights = np.abs(layer).sum(0)

    # actual pruning operation
    layer[:, masking_fun