def build_model(layers, model=None, input_dim=None):
    "\n    Build and return a Sequential model with Dense layers given by the layers argument.\n\n    Arguments\n        model      (keras.Sequential) model to which layers will be added\n        input_dim  (int) dimension of input\n        layers     (tuple) sequence of 2-ples, one per layer, such as ((64, 'relu'), (64, 'relu'), (1, 'sigmoid'))\n\n    Return\n        model_name (str) a name for the model\n        model      (Model) a compiled model\n    "
    if (model is None):
        model = Sequential()
    model_name = io.StringIO()
    (layer_type, kwargs) = layers[0]
    if (input_dim is None):
        pass
    else:
        kwargs['input_dim'] = input_dim
    for (layer_type, kwargs) in layers:
        layer = build_layer(model_name, layer_type, kwargs)
        model.add(layer)
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
    return (model_name.getvalue()[1:], model)
Build and return a Sequential model with Dense layers given by the layers argument.

Arguments
    model      (keras.Sequential) model to which layers will be added
    input_dim  (int) dimension of input
    layers     (tuple) sequence of 2-ples, one per layer, such as ((64, 'relu'), (64, 'relu'), (1, 'sigmoid'))

Return
    model_name (str) a name for the model
    model      (Model) a compiled model
def build_model(layers, model=None, input_dim=None):
    "\n    Build and return a Sequential model with Dense layers given by the layers argument.\n\n    Arguments\n        model      (keras.Sequential) model to which layers will be added\n        input_dim  (int) dimension of input\n        layers     (tuple) sequence of 2-ples, one per layer, such as ((64, 'relu'), (64, 'relu'), (1, 'sigmoid'))\n\n    Return\n        model_name (str) a name for the model\n        model      (Model) a compiled model\n    "
    if (model is None):
        model = Sequential()
    model_name = io.StringIO()
    (layer_type, kwargs) = layers[0]
    if (input_dim is None):
        pass
    else:
        kwargs['input_dim'] = input_dim
    for (layer_type, kwargs) in layers:
        layer = build_layer(model_name, layer_type, kwargs)
        model.add(layer)
    model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
    return (model_name.getvalue()[1:], model)