code: def dataset_spike_counts(dset, threshold, fs):
      
      if len(dset.shape) == 3:
          results = np.zeros(dset.shape[0])
          for itrace in range(dset.shape[0]):
              results[itrace] = count_spikes(dset[itrace], threshold, fs)
          return results
      elif len(dset.shape == 2):
          return count_spikes(dset, threshold, fs)
      else:
          raise Exception("Improper data dimensions")
docs: Dataset should be of dimensions (trace, rep, samples)