def __get_population(spike_trains, population):
    'Helper function to figure out which population of nodes to use.'
    pops = spike_trains.populations
    if (population is None):
        if (len(pops) > 1):
            raise Exception('SpikeTrains contains more than one population of nodes. Use "population" parameter to specify population to display.')
        else:
            return pops[0]
    elif (population not in pops):
        raise Exception('Could not find node population "{}" in SpikeTrains, only found {}'.format(population, pops))
    else:
        return population
Helper function to figure out which population of nodes to use.
def __get_population(spike_trains, population):
    
    pops = spike_trains.populations
    if (population is None):
        if (len(pops) > 1):
            raise Exception('SpikeTrains contains more than one population of nodes. Use "population" parameter to specify population to display.')
        else:
            return pops[0]
    elif (population not in pops):
        raise Exception('Could not find node population "{}" in SpikeTrains, only found {}'.format(population, pops))
    else:
        return population