def __register_services(api_name_version_map, api_config_registry):
    generator = api_config.ApiConfigGenerator()
    protorpc_services = []
    for service_factories in api_name_version_map.itervalues():
      service_classes = [service_factory.service_class
                         for service_factory in service_factories]
      config_dict = generator.get_config_dict(service_classes)
      api_config_registry.register_backend(config_dict)
      for service_factory in service_factories:
        protorpc_class_name = service_factory.service_class.__name__
        root = '%s%s' % (service_factory.service_class.api_info.base_path,
                         protorpc_class_name)
        if any(service_map[0] == root or service_map[1] == service_factory
               for service_map in protorpc_services):
          raise api_config.ApiConfigurationError(
              'Can\'t reuse the same class in multiple APIs: %s' %
              protorpc_class_name)
        protorpc_services.append((root, service_factory))
    return protorpc_services