def load_neurons(neurons,<EOL>neuron_loader=load_neuron,<EOL>name=None,<EOL>population_class=Population,<EOL>ignored_exceptions=()):
if isinstance(neurons, (list, tuple)):<EOL><INDENT>files = neurons<EOL>name = name if name is not None else '<STR_LIT>'<EOL><DEDENT>elif isinstance(neurons, StringType):<EOL><INDENT>files = get_files_by_path(neurons)<EOL>name = name if name is not None else os.path.basename(neurons)<EOL><DEDENT>ignored_exceptions = tuple(ignored_exceptions)<EOL>pop = []<EOL>for f in files:<EOL><INDENT>try:<EOL><INDENT>pop.append(neuron_loader(f))<EOL><DEDENT>except NeuroMError as e:<EOL><INDENT>if isinstance(e, ignored_exceptions):<EOL><INDENT>L.info('<STR_LIT>',<EOL>e, os.path.basename(f))<EOL>continue<EOL><DEDENT>raise<EOL><DEDENT><DEDENT>return population_class(pop, name=name)<EOL>
Create a population object from all morphologies in a directory\
        of from morphologies in a list of file names

    Parameters:
        neurons: directory path or list of neuron file paths
        neuron_loader: function taking a filename and returning a neuron
        population_class: class representing populations
        name (str): optional name of population. By default 'Population' or\
            filepath basename depending on whether neurons is list or\
            directory path respectively.

    Returns:
        neuron population object