def convert_flatten(builder, layer, input_names, output_names, keras_layer):
    """Convert a flatten layer from keras to coreml.

    Parameters
    keras_layer: layer
    ----------
        A keras layer object.

    builder: NeuralNetworkBuilder
        A neural network builder object.
    """
    input_name, output_name = input_names[0], output_names[0]
    blob_order = 0
    if len(keras_layer.input.shape) == 4:
        blob_order = 1
    builder.add_flatten(name=layer, mode=blob_order, input_name=input_name,
        output_name=output_name)
