'Retrieves the model configuration as a Python list.
# Returns
A list of dicts (each dict is a layer config).'

def legacy_get_config(self):

    config = []
    if isinstance(self.layers[0], legacy_layers.Merge):
        assert hasattr(self.layers[0], 'layers')
        layers = []
        for layer in self.layers[0].layers:
            layer_config = {'class_name': layer.__class__.__name__, 'config': layer.get_config()}
            layers.append(layer_config)
        merge_config = self.layers[0].get_config()
        merge_config['layers'] = layers
        config.append({'class_name': 'Merge', 'config': merge_config})
    else:
        config.append({'class_name': self.layers[0].__class__.__name__, 'config': self.layers[0].get_config()})
    for layer in self.layers[1:]:
        config.append({'class_name': layer.__class__.__name__, 'config': layer.get_config()})
    return copy.deepcopy(config)
