def get_net(trainer_model, name):
    """
    Helper method to get a layer with a given name out of a model
    :param trainer_model: base model
    :param name:          layer name
    :return:              a layer with the specified name
    """
    layers = [l for l in trainer_model.layers if l.name == name]
    assert len(layers) == 1
    return layers[0]