import numpy as np


def spikecounts(spike_trains, dt, t_start, t_end):
    bins = np.arange(t_start, t_end+dt, dt)
    hists = [np.histogram(spike_trains[neuron_idx], bins=bins, range=(t_start, t_end))[0] for neuron_idx in \
            spike_trains.keys()]

    return np.vstack(tuple(hists))