def GenApiConfig(service_class_names, generator=None, hostname=None):
  """Write an API configuration for endpoints annotated ProtoRPC services.

  Args:
    service_class_names: A list of fully qualified ProtoRPC service classes.
    generator: An generator object that produces API config strings using its
      pretty_print_config_to_json method.
    hostname: A string hostname which will be used as the default version
      hostname. If no hostname is specificied in the @endpoints.api decorator,
      this value is the fallback. Defaults to None.

  Raises:
    TypeError: If any service classes don't inherit from remote.Service.
    messages.DefinitionNotFoundError: If a service can't be found.

  Returns:
    A map from service names to a string containing the API configuration of the
      service in JSON format.
  """
  service_map = {}
  generator = generator or api_config.ApiConfigGenerator()
  for service_class_name in service_class_names:
    module_name, base_service_class_name = service_class_name.rsplit('.', 1)
    module = __import__(module_name, fromlist=base_service_class_name)
    service = getattr(module, base_service_class_name)
    if not (isinstance(service, type) and issubclass(service, remote.Service)):
      raise TypeError('%s is not a ProtoRPC service' % service_class_name)


    hostname = service.api_info.hostname or hostname
    service_map[service_class_name] = generator.pretty_print_config_to_json(
        service, hostname=hostname)

  return service_map
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/endpointscfg.py/GenApiConfig/original