'Munge catalogs from internal to output format.
Internal catalogs look like::
{$REGION: {
{$SERVICE: {
$key1: $value1,
The legacy api wants them to look like::
[{\'name\': $SERVICE[name],
\'type\': $SERVICE,
\'endpoints\': [{
\'tenantId\': $tenant_id,
\'region\': $REGION,
\'endpoints_links\': [],'

@classmethod
def format_catalog(cls, catalog_ref):

    if (not catalog_ref):
        return []
    services = {}
    for (region, region_ref) in catalog_ref.items():
        for (service, service_ref) in region_ref.items():
            new_service_ref = services.get(service, {})
            new_service_ref['name'] = service_ref.pop('name')
            new_service_ref['type'] = service
            new_service_ref['endpoints_links'] = []
            service_ref['region'] = region
            endpoints_ref = new_service_ref.get('endpoints', [])
            endpoints_ref.append(service_ref)
            new_service_ref['endpoints'] = endpoints_ref
            services[service] = new_service_ref
    return list(services.values())
