def build_layer(model_name, layer_type, kwargs):
    if (layer_type == 'Dense'):
        model_name.write('_dns_{}'.format(kwargs['units']))
        if ('kernel_regularizer' in kwargs):
            model_name.write('_l2_{:6.4f}'.format(kwargs['kernel_regularizer'].l2.item()))
        layer = Dense(**kwargs)
    elif (layer_type == 'Dropout'):
        model_name.write('_drp_{:3.2f}'.format(kwargs['rate']))
        layer = Dropout(**kwargs)
    elif (layer_type == 'BatchNormalization'):
        model_name.write('_bn')
        layer = BatchNormalization(**kwargs)
    else:
        raise Exception()
    return layer
def build_layer(model_name, layer_type, kwargs):
    if (layer_type == 'Dense'):
        model_name.write('_dns_{}'.format(kwargs['units']))
        if ('kernel_regularizer' in kwargs):
            model_name.write('_l2_{:6.4f}'.format(kwargs['kernel_regularizer'].l2.item()))
        layer = Dense(**kwargs)
    elif (layer_type == 'Dropout'):
        model_name.write('_drp_{:3.2f}'.format(kwargs['rate']))
        layer = Dropout(**kwargs)
    elif (layer_type == 'BatchNormalization'):
        model_name.write('_bn')
        layer = BatchNormalization(**kwargs)
    else:
        raise Exception()
    return layer